How to find indices of pixels outward from a detected boundary
显示 更早的评论
Hello,
I am working on an application in which I am required to find the pixel value indices extruding out from the largest region. I have found the boundary of the region but can't of way to ensure that pixels are always looked for outwards from the boundary. I would be thankful if you guys could contribute on the matter.
a=logical([0 0 0 0 1;0 1 1 0 0;0 0 1 1 0;0 1 1 1 0; 0 0 1 1 0;1 0 0 0 0]); %Test matrix
acon=regionprops(a,'Area','PixelIdxList'); %finds the connected components
loca=find([acon.Area]==max([acon.Area])); %Pixel seq index of largest comp
%in detected regions
abound=bwboundaries(a,8,'noholes'); %Finds location of boundary of region
dom_bound=abound{loca}; %Get locations of boundary pixels
1 个评论
回答(2 个)
Image Analyst
2013-6-20
0 个投票
Not exactly sure what you want. But once you've extracted the largest blob (I've posted code for that here before), then you can call imdilate() to enlarge that blob by one layer of pixels, and then call bwboundaries(). Is that what you meant?
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
