Matlab,如何获得imagesc生成的结果? [英] Matlab, How to get the result generated by imagesc?

查看:988
本文介绍了Matlab,如何获得imagesc生成的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了一些类似的文章,但它们不是我想要的。

获取imagesc后的矩阵?

imagesc在matlab中绘制矩阵




我的问题

我有一个矩阵 A ,所有元素都是双倍。

我做 imagesc(A)然后我有一张图片。

现在,我想获得制作图像的矩阵。 我该怎么做?



从这些文章中,如果我这样做的话

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')

然后 B == A 这不是我想要的。

推荐答案

以与imagesc相同的方式缩放图像,执行以下操作

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);

这篇关于Matlab,如何获得imagesc生成的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆