필터 지우기
필터 지우기

How can i measure length interactively in axes in gui?

조회 수: 8 (최근 30일)
Abarairenji
Abarairenji 2012년 8월 6일
답변: Image Analyst 2014년 1월 7일
I need to use interactive rulers for one of my axes in my gui. I need to measure length of a line i draw interactively in image. And see its length. All of my pictures are 20cm x 20cm so i know the lenght of my image so it will be easier. But i dont know how can i do it interactively in my gui creating ruler button. Thanks for helps...
Respectfully yours; Abarairenji

채택된 답변

Image Analyst
Image Analyst 2014년 1월 7일
Use imdistline() in the Image Processing Toolbox.

추가 답변 (1개)

Caleb
Caleb 2012년 8월 8일
You should be able to use something like this:
figure;
axis manual
ruler = imline(gca);
% Get original position
pos = getPosition(ruler);
% Get updated position as the ruler is moved around
id = addNewPositionCallback(ruler,@(pos) title(mat2str(pos,3)));
You can use the getPosition function to get the original position and as you stretch it or drag it around, you use addNewPositionCallback to get the updated position. From here you can calculate the length using Pythagorean's theorem.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by