필터 지우기
필터 지우기

how can I save an image which drawn line plot with original resolution?

조회 수: 2 (최근 30일)
qc C
qc C 2016년 10월 1일
답변: qc C 2016년 10월 7일
Hello everyone,
I need some help on saving images. I displayed an image and plot some lines in a axes object. Then I want to save the image with lines without reducing resolution. what should I do?
I have tried some methods but did not meet my requirement. The original resolution of my image is 2448*2048.
I=imread(imgpath);
imshow(I);
plot(x,y,'r-');
...
imwrite(I, 'Image.tif');
%This way I can save image with resolution of 2448*2048, but it did not contain lines I drew.
Then the second method still did not work.
I=imread(imgpath);
imshow(I);
plot(x,y,'r-');
...
F = getframe(hthandles.axes1);
Image = frame2im(F);
imwrite(Image, 'Image.tif');
%This way I can save the picture of axes1. But it just like a screenshot and have a low resolution of 581*519.
The third method I tried.
saveas(handles.axes1,'Image.jpg');
%This way save the panel picture with a low resolution of 1200*900.
So,what should I do to save image and lines with original resolution. I don't want to loss any information of image.
Thank you.

채택된 답변

qc C
qc C 2016년 10월 7일
I have solved this question by myself.
I = imread(...);
shape = [...];
I = insertShape(I, 'Polygon', shape, 'Color', 'red');
imwrite(I,'myimage.jpeg');
%Also we can use insertMarker,inserText if we want to insert something into an image.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by