Image from matrix with specific x y scaling
2 次查看(过去 30 天)
显示 更早的评论
I have a 38x2252 matrix representing an image. I also have an asymmetrix x and y value distribution between the pixels in this image. I.e. the vector of x locations is [1:38]*200 (in nanometers) and the vector of y locations is [1:2252]*4.5 (in nanometers).
When displaying this image, is it possible to scale the view such that the pixel locations are plotted to scale as compared to their corresponding x y coordinates? Also, is it then possible to take this image and convert it to gray scale while maintaining this aspect ratio? Current if I convert to grayscale the image becomes severely compressed because MATLAB scales both axes the same way.
So far I have tried
dy = 4.5e-9;
dx=200e-9;
imshow(I(:,1:2252,10)','XData',[dx dx*38],'YData',[dy dy*2252]);
But the displayed image is 'too big to fit on screen' This doesn't make sense to be because it's only a 38x2252 image and so shouldn't have any issues on a desktop screen like mine.
Thanks,
0 个评论
回答(1 个)
Will Nitsch
2017-5-25
Have you tried adjusting the 'DataAspectRatio' property of the axes in which the image is displayed?
hFig = figure; hAx = gca; imshow(yourData); hAx.DataAspectRatio = [38*200, 2252*4.5, 1];
Not sure if that's what you are trying to do but perhaps knowledge of that property is useful information for you.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!