This is a small doubt…..I'm stuck in the second example given for bwconncomp by Mathworks. This example removes the group of pixels having largest pixels connected (in an 8 connected neighbourhood):
BW = imread('text.png');imshow(BW);CC = bwconncomp(BW);numPixels = cellfun(@numel,CC.PixelIdxList);[biggest,idx] = max(numPixels);BW(CC.PixelIdxList{idx}) = 0;figure, imshow(BW);
I want to change the code to erase groups of pixels which have between 20 to 70 connected pixels (in their 8 connected neighbourhood). How can I do this?
If I do:
idx = numPixels < 70;
I get an error saying : " Maximum variable size allowed by the program is exceeded."
Best Answer