I have two grayscale images, I1 of size (w1,h1), and I2 of size (w2,h2). I would like Matlab to display them in the same figure, like this:
figure;
subplot(2,1,1), imshow(I1);
subplot(2,1,2), imshow(I2);
This code makes the images to be resized in order to be displayed with the same width.
I would like to keep the images in their original sizes (each pixel of each image takes one pixel on the screen). Is there any option I can pass to subplot or imshow to do this ?
Use truesize
:
figure
subplot(2,1,1), imshow(I1)
subplot(2,1,2), imshow(I2)
truesize
You will get a warning if it doesn't fit on the screen. Like:
Warning: Image is too big to fit on screen; displaying at 66% scale.
Edit: It worked for me because the two images I used had the same size. Apparently the general case doesn't work.
Try this:
figure;
subplot(2,1,1), imshow(I1); axis equal;
subplot(2,1,2), imshow(I2); axis equal;
You could also try using axis image
.
http://www.mathworks.com/help/matlab/ref/axis.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With