how to show output of the distance between two point?I just find the highest location of white pixel.

조회 수: 1 (최근 30일)
I want to find the distance from the highest point location (highestWhiteRow,thatColumn) to the lastRow,thatColumn.After that,the 1row is equal to 3meter. But i'm got stuck to display the result of distance between that two points.
true
%highest point location
row=find(sum(img8,2)==0,1,'last')+1;
col=find(img8(row,:)~=0);
row=row(ones(size(col)));
Points=[row(:) col(:)];
imshow(img8);
title('Highest Point Location')
hold on
plot(Points(:,2),Points(:,1),'rp','MarkerSize',10)
a=text(Points(1,2),Points(1,1),['This is (',num2str(Points(1,2)),',',num2str(Points(1,1)),')']);
set(a, 'FontName', 'Arial' ,'FontWeight', 'bold', 'FontSize', 12,'Color', 'green');
%highest distance
% Find the distance.
xd=240-Points(:,2);
yd=Points(:,1)-Points(:,1);
distance=sqrt(xd.*xd + yd.*yd);
Dmeter=distance.*3;%one row=3meter
D=text(['Distance is(',num2str(Dmeter),')']); %show result of distance
set(D, 'FontName', 'Arial' ,'FontWeight', 'bold', 'FontSize', 12, 'Color', 'yellow');
  댓글 수: 2
Jan
Jan 2015년 5월 4일
The question is not clear. What do you want to show, what does "show" exactly mean (in the command window or as a diagram?)? What does the code demonstrate?
Please edit the question and post any details.

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by