简体   繁体   中英

Set Pixel Dimensions in Matlab

I am pretty new to MatLab. I simply want to display an image for viewing, the image is 1024 x 1024 array. I have been using imagesc to display the image with a line of code such as this:

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. 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. 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

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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