Image Processing - Finding Length and Diameter of a Curved Object.
Show older comments
I have a curved wire, and I am trying to find its contour length and average diameter.
I have already imported the image and converted it to a binary matrix. I then cleaned up the image with bwareaopen, imfill, and imopen. I found the perimeter of the wire with bwperim and I hope to now find the centerline of the wire. This is where I am having trouble. I hope to calculate the contour length of the centerline to get the length of the wire, and will use the difference between the perimeter lines and the centerline to find radius.
I have attempted to use bwmorph(IMG,'skel') and bwmorph(IMG,'thin) to find the centerline, however I havn't found a method of properly trimming the branches without affecting the centerline. (I have tried bwmorph(IMG,'spur) I end up with the image below after using the thin function.
- Starting image: http://imgur.com/YMG3ZWm (The white box on the right is used for a scale and is 127.4 mm long)
- MATLAB bwmorph thin image: http://imgur.com/mc0jkrh
- MATLAB bwmorph skel image: http://imgur.com/pUy2Xeo
Both of the bwmorph images appear to have gaps however they are continuous.
I have seen forum users such as Image Analyst suggest taking the skeleton and multiplying it by the euclidean distance transform of the original image to find the distances however I haven't been able to get that method to work either.
Any advice would be great. I have been stuck on this all week.
Thanks,
Kevin
3 Comments
Ankit Jaiswal
on 24 Apr 2023
can you share your code for my reference?
this will be help to me.
i need to find length of object inside microchannel asd attached.

Image Analyst
on 24 Apr 2023
Edited: Image Analyst
on 24 Apr 2023
@Ankit Jaiswal please start your own discussion thread on this, and let us know there if the tube walls are in the same place in every image, and if you have an image with no curved object in it (and attach that image if you do).
Attach your data and code to read it in with the paperclip icon, in your new discussion thread, after you read this:
I gave you a start in the attachments.

Ankit Jaiswal
on 28 Apr 2023
Edited: Ankit Jaiswal
on 28 Apr 2023
please find problem as per your instructions.please reply to the question by visiting above link.
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!