필터 지우기
필터 지우기

Increase the resolution of a filled image

조회 수: 15 (최근 30일)
Boris Huljak
Boris Huljak 2018년 4월 11일
댓글: Sagar Shriram Salwe 2019년 9월 30일
Hello, I am trying to make an B&W image out of a contour of a plot. The code I use so far is below, where B2 is a matrix of 2 columns that holds the x and y position of the contour. The code actually works well, but the problem I have is that I get a 560x420 image, and I can not figure out how to get a better resolution. Do you have any idea on how to do this ? Thanks !
figure;
fill(B2(:,1),B2(:,2),'w')
axis([-200 200 -200 200])
set(gca,'visible','off')
set(gcf,'color',[0 0 0])
F = getframe(gcf);
figure;
imshow(F.cdata)

답변 (1개)

Ameer Hamza
Ameer Hamza 2018년 4월 25일
The documentation of getframe() tells that output resolution depends on the screen resolution. You can increase the size of figure object as follow calling getframe() as follow,
f = gcf;
f.Position = [100 100 width height]; % here specify the width and height of the figure.
% corresponding to this, the image resolution will also change.
F = getframe(f);
Another way is to use imresize() but the quality is low as compared to the first method.
If you want really high-quality graphics, you might want to save figure as a vector graphic image e.g. .eps file using following command,
hgexport(gcf, 'test');
  댓글 수: 1
Sagar Shriram Salwe
Sagar Shriram Salwe 2019년 9월 30일
The simplest method to solve this i find out:
Just go to figure created by imagesc
Open file >Export setup and change the size from auto to expected size required.
Suppost 1920x1024 points and save this configuration and again rerun the .m file without closing image.
The expected changes required for high resolution will get obtained after doing this.
Hope this will help

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by