Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: MATLAB
Replies: 1   Last Post: Mar 11, 2013 10:39 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
dpb

Posts: 6,692
Registered: 6/7/07
Re: MATLAB
Posted: Mar 11, 2013 10:39 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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...

--






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.