In case anyone wants to try to reproduce this, I've attached the test image.
How does bwmorph define a branch point
6 ビュー (過去 30 日間)
古いコメントを表示
I have attempted, with the following code,
skel=bwmorph(msk,'skel',inf);
bw = skel&~bwmorph(skel,'branchpoints');
to remove the branch points from skeletonized binary image "skel" resulting in image "bw". Here is a section of skel,

and here is the result, bw, where one can see that only one of the branches was successfully disconnected.

I am wondering why this occurred. I assume I have a mistaken notion of what bwmorph considers a branch point, but then, what does qualify as a branch point? If it is a white pixel with at least 3 white neighbors, then what I attempted should have worked.
I know I could use bwlookup to search for pixels meeting my criteria, but I'm wondering why bwmorph(...,'branchpoints') isn't right for this.
回答 (1 件)
Image Analyst
2016 年 6 月 26 日
The documentation doesn't say exactly but I bet the algorithm is that it looks for a pixel surrounded by 3 or more neighbors. For such pixels, the output image will be true at that pixel location. It looks like you then XORed the branchpoint image with your original image to have the branchpoints removed. Yes, for 4-connected situations, the removal will leave the image branches connected in the 8-connected sense. For them not to be 8-connected, you'll have to dilate the branchpoint image with
bpImage = imdilate(bpImage, true(3))
before XORing it.
8 件のコメント
Image Analyst
2016 年 6 月 27 日
Matt, I see what you mean now - I was looking at the wrong pixel (the one that got removed) because the tips of your arrows do not precisely land on any pixel but just point in the general direction).
Sean, I think that since Matt is starting with a single 8-connected object, he expected after XORing branchpoints that he would now have 5 separated 8-connected regions, but he ends up with only 2. Is there any way to end up with that, other than the branchpoint dilation which I already suggested?
Steve Eddins discussed this exact situation (same shape even!) in his blog: http://blogs.mathworks.com/steve/2014/01/07/automating-data-extraction-2/?s_tid=srchtitle
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!