Date: Mar 11, 2013 10:39 AM
Author: dpb
Subject: Re: MATLAB

On 3/11/2013 5:46 AM, kalai arasi wrote:
> Any one can explain what is the algorithm used here...
> function seg = imseg(img,Lseg,F)
>

...

> % segment the image 'imaster'
> L = size(img);
> max_row = floor(L(1)/Lseg);
> max_col = floor(L(2)/Lseg);
> seg = cell(max_row,max_col);
> r1 = 1; % current row index, initially 1
> for row = 1:max_row
> c1 = 1; % current col index, initially 1
> for col = 1:max_col
> % find end rows/columns for segment
> r2 = r1+Lseg-1;
> c2 = c1+Lseg-1;
> % store segment in cell array
> seg(row,col) = {img(r1:r2,c1:c2,:)};
> % plot segment
> subplot(max_row,max_col,(row-1)*max_col+col)
> imshow(cell2mat(seg(row,col)))
> imwrite(cell2mat(seg(row,col)),'sample1.png');
> end
> % increment col start index
> c1 = c2 +1;
> end


Very little "algorithm" at all -- given an input image and a predefined
length of a so-call segment (Lseg) the linear addresses of subsets of
the image are computed and those subsets pulled out saved as the seg()
cell array elements...

--