-2

I need to show image in a axes in its original scale. Currently when I load image to axes, image is modified to fit with axes. Can anyone please tell me how can I show an image in an axes in its original scale.

Chamath Sajeewa
  • 300
  • 1
  • 14

2 Answers2

4

What you're looking for is: imshow(imgname,'InitialMagnification','fit');

I tested this with subplot, and it only affects the current axes: imshow with supblots

Dev-iL
  • 23,742
  • 7
  • 57
  • 99
  • Maybe you can add `axis on` as OP was talking about `axes`. +1 for a good answer other than that. – Divakar Aug 03 '14 at 15:15
  • @Divakar - I didn't understand what you meant by the 1st part of your comment. The only reason I used subplot was to create "some more" UI elements to see if the image obstructs them (after using `imshow`). When you call `subplot` it creates axes... – Dev-iL Aug 03 '14 at 15:20
  • I am not sure how you are using `subplot`, but I have tried something like this - `subplot,imshow(image_data,'InitialMagnification','fit');` and the `axes` didn't show up, maybe a version issue, IDK. The `axes` definitely shows up with just a call to `subplot`, but with `imshow` it hides I think. – Divakar Aug 03 '14 at 15:47
  • Oh... I see where the confusion stems from. I did `subplot(2,1,1)`, `subplot(2,1,2)`, `imshow`. The axes is still there... It's just hidden by default... If you want it shown you can set it using the image processing toolbox' function `IPTSETPREF(...,'ImshowAxesVisible','on')`. Look inside `imshow`, it's full of goodies :) – Dev-iL Aug 03 '14 at 16:00
0

The truesize() function may be what you are looking for - it adjusts the display size of an image to [rowsize colsize]. You need to have the Image Processing Toolbox to be able to use this.

There is a very related question on SO, but I believe there are easier tools available now. However, the answers to it are still worth checking out, especially if the images you plan on displaying at true-size would not be fitting in the screen and you need to think about scroll-bars on the figure etc. https://stackoverflow.com/a/1427765/297353

Community
  • 1
  • 1
AruniRC
  • 5,070
  • 7
  • 43
  • 73