Save image with same resolution

Hello, I've drawn some circles on an image and i wish to save that image...Though the image was saved with imwrite() command, the image became blur (the resolution reduced). How can I save the image without its quality reduced?
The coding used is as follows:
%Risk Contour
I = imread('Plant latest layout.jpg') ;
imshow(I)
th = linspace(0,2*pi) ;
hold on
message = sprintf('Click where you want the center to be');
uiwait(helpdlg(message));
[xCenter, yCenter] = ginput(1);
for radius =Y
x = radius * cos(th) + xCenter;
y = radius * sin(th) + yCenter;
plot(x, y, '-');
end
hold off
imwrite(F.cdata,'Plant latest layout.jpg') %Save the contour drawn

4 件のコメント

Rik
Rik 2021 年 6 月 16 日
There is no guarantee that your figure will have the same resolution as your image. You will have to ensure that yourself.
Walter Roberson
Walter Roberson 2021 年 6 月 16 日
F is undefined. Presumably your real code has
F = getframe();
HAINGKHARRAN GUNASEKARAN
HAINGKHARRAN GUNASEKARAN 2021 年 6 月 16 日
Yeah, i missed that line here....Thee problem is the image quality ..
Walter Roberson
Walter Roberson 2021 年 6 月 16 日
In my brief test, I am not observing any reduction in image quality, under the conditions:
  • that the original image fit within the screen without reduction
  • that the "blur" being talked about is not the fact that you cannot get sharp edges when you use .jpg (unless you turn the quality up a lot). JPEG is nice for scenes, but not good for preserving edges.
After you do the imshow(), ask
disp(size(I))
ax = gca;
oldunits = ax.Units;
ax.Units = 'pixels';
axpos = ax.InnerPosition;
ax.Units = oldunits;
disp(axpos(3:4))
and then after the getframe, ask
disp(size(F.cdata))
and tell us what show up.

サインインしてコメントする。

回答 (0 件)

質問済み:

2021 年 6 月 16 日

コメント済み:

2021 年 6 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by