获取imagesc后的矩阵? [英] Get the matrix after imagesc?

查看:131
本文介绍了获取imagesc后的矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
在Matlab中将imagesc图绘制为矩阵
将比例矩阵缩放到新范围

Possible Duplicate:
imagesc plot to matrix in matlab
Scale Matrix to a new range

我有:

I = imread('image.tif');

在这一点上,我可以通过执行I(100,100)轻松地用线100,100打印像素.
现在我缩放到图像以适应范围0.5...0.9

At this point I can easly print the pixel with cord 100,100 by doing I(100,100)
Now I scale to image to fit the range 0.5...0.9

imagesc(I,[0.5 0.9]);
colormap('gray');

有什么方法可以获取新矩阵I吗? (像素值介于0.5到0.9之间)

Is there any way to get the new matrix I ? (with pixel values from 0.5 to 0.9)

如果我愿意

I  = imagesc(I,[0.5 0.9]);

我只让处理程序处理图像对象

I only get the handler to image object

推荐答案

您可以使用以下方法从图像图中获取图像数据:

You can get the image data from an image plot with:

A = rand(100,100);
I = imagesc(A, [.5 .9]);
B = get(I, 'CData');

根据您之前的问题进行预测:将比例矩阵缩放到新范围期望B不会是您想要的.实际上,B将与A相同.可以使用以下方法进行验证:

Predicting from your previous question: Scale Matrix to a new range I expect that B won't be you want. In fact B will be identical to A. This can be verified with:

all(all(A==B))

imagesc的第二个参数不会缩放提供的矩阵中的值,而是缩放颜色图.

The second argument to imagesc doesn't scale the values in the provided matrix rather it scales the colormap.

这篇关于获取imagesc后的矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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