croping of an image without imcrop

6 ビュー (過去 30 日間)
U B
U B 2021 年 11 月 30 日
コメント済み: U B 2021 年 12 月 1 日
I am trying to crop an image using cordinate. I'm using the code given below.
I = imread('figure23.png');
I2 = imcrop(I,[185 49 535 534]);
figure, t=imshow(I2);
saveas(t,'E:\UB\MATLAB\X\1.png');
But while saving it, it gives me the crop image with a title "croped image" and gives white backgroud. how do i get the only croped part?
For the reference, I'm attaching the croped image using the above code.

採用された回答

DGM
DGM 2021 年 11 月 30 日
編集済み: DGM 2021 年 11 月 30 日
Don't save displayed images; save the image itself.
imwrite(I2,'E:\UB\MATLAB\X\1.png');
Saving a displayed image is tantamount to taking a screenshot. The image itself will be subject to rescaling using nearest-neighbor interpolation, and it will have all the extra padding and junk added.
  1 件のコメント
U B
U B 2021 年 12 月 1 日
It worked. Thank you for the explanation.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by