How to mark the (last row,this column) of finding the highest white pixels through each column.

조회 수: 1 (최근 30일)
the code for find the white pixels through each column,and mark into the point.
true
BWImage=imread('BWImage.png');
>> row=find(sum(BWImage,2)==0,1,'last')+1;
col=find(BWImage(row,:)~=0);
row=row*ones(size(col));
Points=[row(:) col(:)];
imshow(BWImage)
hold on
plot(Points(:,2),Points(:,1),'rs','MarkerSize',10)
how to mark both point of the row found and lastRow,this Column?(both red and green mark)
  댓글 수: 2
Image Analyst
Image Analyst 2015년 5월 3일
Where are the green marks? If they're not at the very last row, then where are they?
Nurul Najmah
Nurul Najmah 2015년 5월 3일
편집: Nurul Najmah 2015년 5월 3일
i want to find the distance from the mark(red) to the lastRow,thatColumn. Means i need to find the point on the lastRow of that point.

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

답변 (1개)

Image Analyst
Image Analyst 2015년 5월 3일
First get the size of your binary image:
[rows, columns] = size(binaryImage);
The last row is the value in "rows".
  댓글 수: 8
Nurul Najmah
Nurul Najmah 2015년 5월 4일
means that distance=((lastRow,thisColumn)-(points(:,2),point(:,1))?
Nurul Najmah
Nurul Najmah 2015년 5월 4일
if true
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
% Compute the ordinary Euclidean 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');
i got stack to show the result of the distance.

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

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by