Changing size in imshow

조회 수: 193 (최근 30일)
NS
NS 2011년 7월 9일
댓글: arnold 2020년 2월 29일
Hi Guys,
Whenever I want to display an image using imshow, it is always displayed at a smaller size. I get the following warning, "Warning: Image is too big to fit on screen; displaying at 67%".
Is there any way to display the image at 100% or maybe higher?
NS

채택된 답변

Image Analyst
Image Analyst 2011년 7월 10일
See this demo, from the help for imscrollpanel:
rgbImage = imread('concordaerial.png');
% 1. Create a scroll panel.
hFig = figure('Toolbar','none',...
'Menubar','none');
hIm = imshow(rgbImage);
hSP = imscrollpanel(hFig,hIm);
set(hSP,'Units','normalized',...
'Position',[0 .1 1 .9])
% 2. Add a Magnification Box and an Overview tool.
hMagBox = immagbox(hFig,hIm);
pos = get(hMagBox,'Position');
set(hMagBox,'Position',[0 0 pos(3) pos(4)])
imoverview(hIm)
% 3. Get the scroll panel API to programmatically control the view.
api = iptgetapi(hSP);
% 4. Get the current magnification and position.
mag = api.getMagnification();
r = api.getVisibleImageRect();
% 5. View the top left corner of the image.
api.setVisibleLocation(0.5,0.5)
% 6. Change the magnification to the value that just fits.
api.setMagnification(api.findFitMag())
% 7. Zoom in to 1600% on the dark spot.
api.setMagnificationAndCenter(16,306,800)
  댓글 수: 1
NS
NS 2011년 7월 10일
Awesome..it works :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

bym
bym 2011년 7월 9일
imshow('pout.tif','InitialMagnification',200)
  댓글 수: 4
Image Analyst
Image Analyst 2014년 3월 17일
Again, poutis smaller than the screen. My answer stands. Read the original poster's question. He has an image LARGER than the screen and wants it pixel for pixel, not shrunken down. What you did is the same as what proecsm. True, it works but it's for images smaller than the screen, not larger like the original poster wanted.
arnold
arnold 2020년 2월 29일
I'm having this problem in 2020 still. Really annoying, that the argument of InitialMagnification doesn't work if the images are larger than the screen and I can't seem to find a workaround.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by