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
Best Answer