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 CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by