Measure the distance of a curve within an image
13 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Benjamin Thompson
2022 年 1 月 25 日
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 件のコメント
Image Analyst
2022 年 1 月 25 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!