i want to mark only the highest middle point of binary image but it show the min point too.
4 ビュー (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149367/image.png)
% 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
0 件のコメント
回答 (3 件)
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 件のコメント
Abdullah bashanfer
2016 年 7 月 17 日
How did you fill the image from bottom? can u provide the codes of that part plz ?
Image Analyst
2016 年 7 月 17 日
Image Analyst
2015 年 4 月 23 日
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);
0 件のコメント
Image Analyst
2015 年 4 月 26 日
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!