简体   繁体   English

在Matlab中设置像素尺寸

[英]Set Pixel Dimensions in Matlab

I am pretty new to MatLab. 我是MatLab的新手。 I simply want to display an image for viewing, the image is 1024 x 1024 array. 我只想显示一个图像以供查看,该图像为1024 x 1024阵列。 I have been using imagesc to display the image with a line of code such as this: 我一直在使用imagesc来显示带有如下代码行的图像:

imagesc(xRange, yRange, imageData, [Min Max]);

However my image dimensions are not equal. 但是我的图像尺寸不相等。 For example, my image width is 10mm but in height it is 300mm, so I want it to appear reflecting this, so in this case I would expect it to appear very narrow but tall because the height is so much greater than the width. 例如,我的图像宽度是10mm,而高度是300mm,所以我希望它看起来像是在反映这种情况,因此在这种情况下,我希望它看起来很窄但很高,因为高度远大于宽度。 Instead it displays as a square which does not reflect the true dimensions. 而是显示为未反映真实尺寸的正方形。

I have looked at some MatLab functions but have not been successful in finding the correct one to do this. 我看过一些MatLab函数,但没有成功找到正确的函数来完成此任务。 Does anybody know how i can set it so each pixel, point in the image is displayed reflecting its true dimensions? 有谁知道我如何设置它,以便显示图像中的每个像素点,反映其真实尺寸? Thanks! 谢谢!

Try using daspect 尝试使用daspect

imagesc( imageData ); 
daspect([ 1 30 ] );

Set your x and y ranges in terms of the desired image dimensions, and set the axes to be equal: 根据所需的图像尺寸设置x和y范围,并将轴设置为相等:

imagesc(xRange, yRange, imageData, [Min Max]);
axis equal tight

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM