How to Get Index Values of an Image by imagesc

19 ビュー (過去 30 日間)
HANS
HANS 2012 年 8 月 20 日
Hi everyone,
I have a matrix that includes complex values. I am using imagesc to see the output. I can see the index values by using data cursor but How can I assign and get index values of that output ?
Thanks BR Hans
  2 件のコメント
Manuel
Manuel 2012 年 12 月 10 日
編集済み: Manuel 2012 年 12 月 10 日
Hello:
I also need the intensity values but not only the max of the picture, but also all of them, in order to save this values into a matrix and to calculate the intensity average value.
Thank you in advance, Manuel
Image Analyst
Image Analyst 2012 年 12 月 10 日
You already have the values, or else you would not have been able to display anything. meanIntensity = mean(yourImage(:)). Why don't you start your own thread to discuss further?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2012 年 8 月 21 日
What is "the output" - is that the same as "matrix" or is it different? And imagesc doesn't work with complex images. Can you explain how you got it to work? Also I don't know what you mean by index. If you use impixelinfo you can see the x (column) and y (row) and the value (gray level). And there is also some funky colormap applied to the image, which you can retrieve. But I don't know which of these several numbers you call "index". Do you mean like the index into a colormap (i.e. the intensity value), or the linear index of the image (i.e. the pixel location), or something else. And I don't know what you want to do when you say you want to "assign" and "get" the indexes. Why do you need to both set and get these values (whatever they are)?
% Generate some sample complex image.
realPart = rand(300);
imaginaryPart = i * rand(300);
complexImage = realPart + imaginaryPart;
% Try to display complex image - won't work.
% imagesc(complexImage); % Does not work.
% Display the real part only.
imagesc(realPart);
% Set up where it will show x, y, and value in status line.
impixelinfo;
% Get the current colormap
cmap = colormap
  3 件のコメント
Image Analyst
Image Analyst 2012 年 8 月 21 日
How about if you use ginput() go get an x,y coordinate and then just assign your parameter like this:
% Find the value where the user clicks.
uiwait(msgbox('Click a point'));
[x y] = ginput(1);
row = int32(y)
column = int32(x)
a = realPart(row, column);
b = i * imaginaryPart(row, column);
theParameter = a + i * b
Or find the max over the entire image, if you don't want them to click anywhere.
% Find the location of the max intensity value
% of the real part over the entire image.
[row column] = find(realPart == max(realPart(:)), 1, 'first')
aMax = realPart(row, column);
bMax = i * imaginaryPart(row, column);
theParameterFromTheMax = aMax + i * bMax
HANS
HANS 2012 年 8 月 22 日
I appreciated your help. :] Thanks a lot. It does.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 8 月 20 日
See the File Exchange contribution "freezeColors"
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 8 月 21 日
The mapping done by freezeColors is not very complex; you can extract the ideas and implement them in a few lines.
HANS
HANS 2012 年 8 月 22 日
Thanks a lot. I will try. It is sure that it helps.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by