Finding a way to measure the width and length automatically in image

8 ビュー (過去 30 日間)
christine QQ
christine QQ 2021 年 11 月 3 日
回答済み: yanqi liu 2021 年 11 月 5 日
Hello, everyone. I want to ask a question about- how to measure my target's length (red) and width(orange) in an image automatically. My image will look like a point image and sometimes will have some noise point too. Do I need to convert it into a scatter plot before I do any fitting?
I am a super beginner at using Matlab, so please answer me as easily as possible. Thank you so much for helping me out during these difficult times. Your help will be invaluable!!!
  2 件のコメント
Matt J
Matt J 2021 年 11 月 3 日
The width looks non-constant along the length of the shape.
christine QQ
christine QQ 2021 年 11 月 3 日
Yes, the true situation is non-constant along the length of the shape. So I am wondering is it possible to do so? I saw some people say that it can use curve fitting to find the length first. Then, use the centerline to find the width. Though, I still feel confused about how to convert my image into a plot, so that I can use curve fitting to find the length. Is it possible to convert my point image into a point plot?
Thank you for answering my question!!

サインインしてコメントする。

回答 (1 件)

yanqi liu
yanqi liu 2021 年 11 月 5 日
clc; clear all; close all;
im = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/788865/image.png');
bw = im2bw(im);
bw = ~bw;
jm = im(:, round(size(bw,2)/2):end, :);
bw = bw(:, round(size(bw,2)/2):end);
bw2 = imclose(bw, strel('disk', 12));
bw2 = bwareafilt(bw2,1);
bw = logical(bw .* bw2);
bw = imclose(bw, strel('disk', 9));
bw = imopen(bw, strel('disk', 2));
be = bwmorph(bw, 'thin', inf);
be = imdilate(bwareafilt(be,1), strel('disk', 3));
jm1 = jm(:,:,1);jm2 = jm(:,:,2);jm3 = jm(:,:,3);
jm1(be)=255;jm2(be)=0;jm3(be)=0;
jm = cat(3,jm1,jm2,jm3);
figure; imshow(bw, []);
figure; imshow(be, []);
figure; imshow(jm, []);

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by