필터 지우기
필터 지우기

Figure automatically scales by 2

조회 수: 5 (최근 30일)
xiaojuezi
xiaojuezi 2020년 4월 6일
댓글: xiaojuezi 2020년 4월 11일
Hi, I set my figure as below:
figure(1)
set(gcf,'units','pixels','position',[0,0,512,512]);
However, the popped figure window has resolution 1024x1024. When I try to get the result as a matrix:
F = getframe (gcf,[0,0,512,512]);
[img, ~] = frame2im (F);
I would like to get img with resolution 512x512x3, but I get its value as 1024x1024x3.
Is there anyway to solve this problem?
  댓글 수: 4
Walter Roberson
Walter Roberson 2020년 4월 7일
For
  • Windows® systems in which the display dots-per-inch (DPI) value is set higher than 96
  • Macintosh systems with Apple Retina displays
When you set the Units property of a graphics or UI object to 'pixels', the size of each pixel is now device-independent on Windows and Macintosh systems:
  • On Windows systems, 1 pixel = 1/96 inch.
  • On Macintosh systems, 1 pixel = 1/72 inch.
(My Mac happens to be one of the last non-Retina models, so I am not affected by this... which also means that I cannot test work-arounds.)
xiaojuezi
xiaojuezi 2020년 4월 11일
Thank you all ! I think it is a problem of macos, when explicitly setting '-r72' or '-r96' for different os, the problem is solved.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by