MATLAB Answers

Measure distance and angle of object

8 views (last 30 days)
Moufid Meddeb
Moufid Meddeb on 4 Apr 2021
Commented: Image Analyst on 7 Apr 2021
hello my friends, I need help and I trust you, the goal is to measure these measurements in an automatic way
  4 Comments
Moufid Meddeb
Moufid Meddeb on 4 Apr 2021
the difference between each images are measurements a , b , h and two angle . Yes the triangle always in roughly the same location but not roughly the same size. yes the bottom always sloping. this another image

Sign in to comment.

Accepted Answer

darova
darova on 5 Apr 2021
Here is the algorithm
  • crop the region 1 and find min/max x
[m,n] = size(step1);
[~,x1] = find(step1(:,1:n/2),1,'last');
[~,x2] = find(step1(:,n/2:n),1,'first');
a_value = x2-x1;
  • crop region 2
[~,x] = find(step2);
b_value = x(end) - x(1);
  • region 3
[y,~] = find(step3);
h_value = max(y) - min(y);
  4 Comments
Image Analyst
Image Analyst on 7 Apr 2021
x2 = n/2 + find(step1(:,n/2:n),1,'first');

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!