11 November 2016 6 2K Report

in order to extract largest size object(out of many) from an image, i used the following code but i am getting some errors please tell me where i did mistake.

I=imread('361.jpg');

I2=im2bw(I);

cc=bwconncomp(I2);

numPixels=cellfun(@numel,cc.PixelIdList);

[biggestSize,idx]=max(numPixels);

I2=false(size(I2));

I2(cc.PixelIdList{idx})=true;

i am unabe to understand the use of cellinfo() and @numel argument please explain some one. my assumption is that largest area object has maximum no.of pixels.

More Prasad Rao's questions See All
Similar questions and discussions