MATLAB Answers

How do i find the coordinates of point given its intensity ??

35 ビュー (過去 30 日間)
Mohannad Nasir
Mohannad Nasir 2018 年 9 月 16 日
編集済み: Image Analyst 2018 年 9 月 16 日
Hello, I'm working on my senior design project with image processing , but i have an issue that i have an image and i want to find the pixel that have maximum intensity ... i already did that but i don't know how to find the coordinate of this maximum intensity pixel... also is there other way to find pixel that have maximum intensity and its coordinates ??
thanks in advance

  0 件のコメント

サインイン to comment.

採用された回答

Rik
Rik 2018 年 9 月 16 日
編集済み: Rik 2018 年 9 月 16 日
The second output of max returns a linear index, which you can convert to subscripts with ind2sub.
[maxval,maxind]=max(IM(:));
[r,c]=ind2sub(size(IM),maxind);
You can also use the fact that max normally operates on 1 dimension:
[vec,r_vec]=max(IM,[],1);
[maxval,c]=max(vec,[],2);
r=r_vec(c);

  0 件のコメント

サインイン to comment.

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 9 月 16 日
編集済み: Image Analyst 2018 年 9 月 16 日
Use find(), not max():
v = randi(10, 5, 30) % Create small image.
[maxValue, indexes] = max(v(:)) % Does not show ALL maxima locations.
[rows, columns] = find(v == max(v(:))) % Shows ALL maxima locations.
So, find() works. The horrendous help for max says:
[M,I] = max(_) finds the indices of the maximum values of A and returns them in output vector I, using any of the input arguments in the previous syntaxes. If the maximum value occurs more than once, then max returns the index corresponding to the first occurrence.
So what the first sentence promised, the second sentence takes away. It does not return all maxima locations, only the first one per column.
Alternatively, you can also get the max locations as a binary image
binaryImage = grayImage == max(grayImage(:));

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。


Translated by