Measure the distance of a curve within an image
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to learn how to take measurements of different aspects in an image. With the image provided, how would I measure the length of the curved blue line and the diameter of the green circle if the hight of the red box is 3 meters. I will post my code if I can actually get something working. Thank you.
0 comentarios
Respuestas (2)
Benjamin Thompson
el 25 de En. de 2022
You could use imshow to load and display the image, then ginput get get a series of manually selected points on the line. If you have the image processing toolbox, imtool has a bit more image analysis capabilities, and colorThresholder can be used to create a blue color mask so you can get the list of pixels that are part of the blue line and then do further math on those pixels positions.
0 comentarios
Image Analyst
el 25 de En. de 2022
I'd just get a mask of the blue line. Like
[r, g, b] = imsplit(rgbImage);
blueMask = r == 0 & g == 0 & b == 255;
or you can use the Color Thresholder app on the Apps tab of the tool ribbon.
If the line is known to be a single pixel wide then you can just count the number of non-zero pixels.
lineLength = nnz(blueMask);
If the line is thick, then you can get the skeleton image with bwskel first
blueMask = bwskel(blueMask);
lineLength = nnz(blueMask);
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!