Detecting blob with straight or round ends
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
As you can see I have an image here of objects with different shapes. Each object has either a round or straight/flat ends. The objects are classified such that if they have both rounded ends they are called a cigar, if both are straight it's a square rod and if half is round it's a half-cigar. I was wondering if there is an easy way around to detect the straight or round ends of the object? It will be great to receive some inputs from the MATLAB community.
Cheers,
How
0 个评论
回答(1 个)
Image Analyst
2023-1-13
Try bwferet to get the endpoints of the cigars. Then take a certain number of point around the endpoint and fit it to a circle using the attached function. Compute the distance of the training set to the fitted circle to get the average deviation from a circular shape. See how much that number varies for each shape of end. Circular ends will have a low deviation while non-circular ends will have a higher number.
4 个评论
Image Analyst
2023-1-13
Sounds reasonable as long as all points are from the same blob, which should be the case if the blobs are well separated. If not, you'd want to label the image first with bwlabel.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!