clc
close all
clear all


filename='..\vstup_vid\segmenty.avi';

obj=mmreader(filename);
frames=get(obj,'numberOfFrames');
frames_s=get(obj,'FrameRate');

image=double(read(obj,21324));

% Choose different scales
% Segmentation parameter Q; Q small few segments, Q large may segments
Qlevels=2.^(8:-1:0);
% This creates the following list of Qs [256 128 64 32 16 8 4 2 1]
% Creates 9 segmentations
[maps,images]=srm(image,Qlevels);
% And plot them
srm_plot_segmentation(images,maps);

% m=size(images,1)
% for i=1:m
%     figure(Qlevels(i))
%     axes('position',[0 0 1 1])
%     imshow(uint8(images{i}),[])
%     saveas(gcf,['srm' num2str(Qlevels(i))],'png')
% end
