Reshaping Blobs in a Binary
显示 更早的评论
When processing an image with low contrast, I inevitably will distort some of the shapes when I threshold the grayscale image and convert it to binary.
Is there any way to reshape blobs after I have done the conversion to binary? I know the shapes should all be circular, but most have tails or look elongated.
1 个评论
Ryan
2012-6-20
Do you have a sample image? Are you doing any processing before the threshold?
采纳的回答
更多回答(2 个)
Image Analyst
2012-6-20
0 个投票
Perhaps, but it's not easy. Let's say you have a comet-shaped blob - pointier at one end than the other. Use bwboundaries() to get all the boundary coordinates. Use regionprops to get the equation of the major axis, using orientation and centroid. Then take the coordinate from each half of the blob. Half will come from the pointy side and half from the larger, rounder size. Scan each set of coordinates to find the minimum curvature over a range of pixels, say 10 or 20 pixels. The side with the larger minimum radius of curvature will be the circular side and the side with the smaller minimum radius of curvature will be the pointy side.
Alternatively you can use bwmorph('skel') to get the skeleton. Then, perhaps you can use bwmorph('endpoints') to get the ends of the skeleton and see which is closer to a boundary point. The endpoint at the pointy tail end will be closer to the nearest boundary point than the endpoint at the larger round head end. The circle would then be placed at the round head end with a radius equal to, say, the average distance of the closest 10 boundary points. Good luck.
Ryan
2012-6-20
0 个投票
use region props area measurements and dilate the centroid points with a disk structuring element with the appropriate radius (assume circle and use A = pi*r^2). I have also read some academic papers in the past where they filled areas with the largest circle possible, but I am not sure how to program that.
For area of the circle, you could also use "EquivDiameter" from the regionprops.
5 个评论
Image Analyst
2012-6-20
If you have a blob with a long tail, the centroid will not be in the round head, but will be shifted toward the tail so the circle would not overlap the round head part. In the latter half of your answer you may be thinking of the skeleton. The skeleton traces out the locations of the largest circle that can fit inside the blob.
Ryan
2012-6-20
I was assuming exact positioning did not matter because he is willing to reshape. I am unsure how to do that with the skeleton, or maybe I am thinking of the wrong skeleton.
* I updated my answer to add mention of "EquivDiameter" with the region props command.
Image Analyst
2012-6-20
If he had some weird roundish shaped blob and he wanted a round one then he could use the centroid and EquivDiameter to place circles over the blobs. If he wanted the round part of a comet and wanted to discard the tail, then this would mislocate the circle. Your suggestion of uploading and image is a good one. He should also supply an image where he drew the circle outlines on it so we can see what he's really after. Of course the best way is to increase the contrast in the image capture step rather than try to fix it in the image processing step. For example adding more contrast solution, or lighting, or change the color of the lighting, or add fluorescent tagging material, or use dark field illumination or some other kind of illumination, or whatever.
Caleb
2012-6-20
Caleb
2012-6-20
类别
在 帮助中心 和 File Exchange 中查找有关 Image Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!