Length of a thin curved object in an image

A
Audrey · Feb 19, 2022 · 1.9K views
Question
I'd like to use image analysis to calculate the length of a thread.   Because the thread is not entirely straight, I can't just use regionprops, so I think the best option is to use the function bwdistgeodesic   In the bwdistgeodesic function, what is it expecting for the variable "mask"? How could I use image analysis to generate said mask? I've looked into using regionprops 'Extrema' property, but since I'm not sure what the "mask" variable is in bwdistgeodesic, I'm not sure how I would use the x,y dimensions from 'Extrema' in a mask.
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Sep 12, 2026
Because the thread is not entirely straight, I can't just use regionprops,
 
Why not? Couldn't you just do
   S=regionprops(  bwareafilt(BW,1,'smallest') ,'Perimeter');

    length=S.Perimeter/2

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!