How to apply a function (some processing steps) only on a specific part of an image in MATLAB?

StackOverflow https://stackoverflow.com/questions/20665722

문제

I have an image X(m by n) and it is sent to a segmentation process. The new image, Y(m by n), contains 9 segments. However, the segments are some random shapes (I mean, they are not square or rectangular).

Now I need to apply other algorithms separately on each segment. Noting that the segments are non-square or non-rectangular, I cannot use techniques such as BlockProc.

How can I read each segment separately and then apply a specific process only on that segment? Thank you very much.

도움이 되었습니까?

해결책

You can use

Props=regionprops(YourBinaryImage, 'Image');

Then retrieve a cell of the individual objects with Props.Image Then apply the function of your choice to each object using cellfun, for example.

Hope it helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top