cant write image exactly shown by imshow

조회 수: 1 (최근 30일)
talayeh ghodsi
talayeh ghodsi 2020년 4월 5일
댓글: talayeh ghodsi 2020년 4월 6일
hi every body. i have written a code which the result in imshow is ok but when i want to imwrite it, its different and wrong. could any body help me please?
Echo = imread('echo60%-croped-SRAD.jpg');
Mask = imread('mask60%.jpg');
Echo = mat2gray(Echo(:,:,1));
Mask = mat2gray(Mask(:,:,1));
Echo_Com = imcomplement(Echo);
Echo_Com_Final = (Echo_Com.*Mask)*255;
imshow(Echo_Com_Final, [0 255]);
imwrite(Echo_Com_Final,map,'echo60%-croped-SRAD_complement.jpg')
  댓글 수: 2
Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 4월 5일
What "map" are you using? Are you sure it is the right one? Have you tried without it? Also, what exactly you mean by different and wrong?
talayeh ghodsi
talayeh ghodsi 2020년 4월 5일
thanks for your respond sir
i will attach the result images of
imshow(Echo_Com_Final, [0 255]);
and
imwrite(Echo_Com_Final,'echo60%-croped-SRAD_complement.jpg'

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

채택된 답변

Image Analyst
Image Analyst 2020년 4월 5일
To write the image exactly as it is shown, you can use getframe() and then imwrite(). Keep in mind that this is like a screenshot so it won't have the same size and values as the original, underlying image, but it will be "exactly shown by imshow" that you requested
displayedImage = getframe();
imwrite(displayedImage, filename);
Or you can use export_fig()
  댓글 수: 1
talayeh ghodsi
talayeh ghodsi 2020년 4월 6일
exatly because of the change of the size of the result image after save as, i want to save it by imwrite. I need to keep the original size of the image

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by