i want to mark only the highest middle point of binary image but it show the min point too.

% code
%highest point location
[ y, x] = find(maxImage);
points = [ x y];
[d,idx] = pdist2( points, points, 'euclidean', 'Largest', 1);
idx1 = idx( d==max(d));
p={};
for i=1:length(idx1)
p{end+1} = [ points(idx1(i),1), points(idx1(i),2)];
end

답변 (3개)

Guillaume
Guillaume 2015년 4월 23일
편집: Guillaume 2015년 4월 24일
What does highest middle point mean?
I don't understand what the code you've written has anything to do with the subject of your question. Your code is finding which two white pixels are the furthest apart. With the image you've displayed, these are indeed the points in red.
If you want to find the highest point, that would be the point whose row ( x) is the smaller, thus:
[row, col] = find(maxImage); %return the coordinates of all the white pixels
highestrow = min(row);
%find all points on highest row:
highestpoints = [row(row == highestrow) col(row == highestrow)]

댓글 수: 10

i want to find the highest middle point. But in this reference use RGB,and I am already use Sobel and fill from bottom to detect the path of robot vision.
Explain why my code didn't find the point you want. If the top of your binary image is flat, there are several points that are in the same row. Say what column should be chosen as the "middle".
i want to find the highest of white region. Highest point location through y-coordinate or row. Some example i got there,sir but its in RGB. Mine in BW.
And mark the highest point.
So my code works then. It finds the highest line.
sir,do i need to multiply both image? i mean the bw image and the highest point. i cant see the result with the binary and the code that you give. because i want to mark the point on the image.
here is some of my result.
You just need to use plot() to mark the point on the image, and maybe subplot() if you want to change the image you're plotting it on. What I did was what your original question asked, and that was to start with your final binary image, like in the lower left of your screenshot above, and find the top line. I don't know why you want to multiply images now.
sir,at the last image subplot 339,i want to remark the highest point location. means,i need to find the highest value of white pixel through row for each column and just mark it right?
You're asking slightly different things each time, though I'm not sure you realize it. If you want the "highest value of white pixel through row for each column" then you'd scan across columns, extracting one column and use find() to find the first white pixel. See my second answer.
How did you fill the image from bottom? can u provide the codes of that part plz ?
That code was given in my code below. Scroll down this page or click here

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

Try this:
% Find the vertical profile
verticalProfile = sum(binaryImage, 2);
% Find the top row
topRow = find(verticalProfile, 1, 'first');
% Find the center column
centerColumn = size(binaryImage, 2) / 2;
% Plot a dot
plot(centerColumn, topRow, 'r.', 'Markersize', 30);
If you want the "highest value of white pixel through row for each column" then you'd scan across columns, extracting one column and use find() to find the first white pixel.
[rows, columns] = size(binaryImage);
for col = 1 : columns
thisColumn = binaryImage(:, col);
topWhitePointRow(col) = find(thisColumn, 1, 'first');
end
topWhitePointRow will be an array that is 1 by columns long where each element has the top most white pixel in each column.

질문:

2015년 4월 23일

댓글:

2016년 7월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by