I read some similar article, but they are not what I want.
Get the matrix after imagesc?
imagesc plot to matrix in matlab
My Problem
I have a matrix A
with all elements are double.
I do imagesc(A)
and then I have an image.
Now, I want to get the matrix that make the image. How can I do that?
From those articles, if I do
I = imagesc(A)
B = get(I, 'CData')
Then B == A
that is not what I want.
To scale the image in the same way as imagesc do the following
Amin = min(A(:));
Amax = max(A(:));
A_scaled = (A - Amin)/(Amax - Amin);
To prove that the scaled image is what imagesc does internally then try this
imagesc(A,[Amin Amax]);
pause
imagesc(A_scaled);