How to Get Index Values of an Image by imagesc

12 visualizzazioni (ultimi 30 giorni)
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 Commenti
Manuel
Manuel il 10 Dic 2012
Modificato: Manuel il 10 Dic 2012
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 il 10 Dic 2012
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?

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 21 Ago 2012
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 Commenti
Image Analyst
Image Analyst il 21 Ago 2012
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 il 22 Ago 2012
I appreciated your help. :] Thanks a lot. It does.

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 20 Ago 2012
See the File Exchange contribution "freezeColors"
  3 Commenti
Walter Roberson
Walter Roberson il 21 Ago 2012
The mapping done by freezeColors is not very complex; you can extract the ideas and implement them in a few lines.
HANS
HANS il 22 Ago 2012
Thanks a lot. I will try. It is sure that it helps.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by