Written and Read Image files are different..?

Please see the below program...
A=imread('gapi.jpg');
imwrite(A,'enc.jpg');
B=imread('enc.jpg');
isequal(A,B);
After running the above program , it returns the value 0 , indicating that A and B are not equal. But are they the same images?? Why is it different?? Please help me
How can I overcome this, so that the read image files is exactly equal to the written image ???

답변 (1개)

Image Analyst
Image Analyst 2016년 10월 30일

0 개 추천

Of course not. This is because you're using a lossy compression scheme: JPEG. The way that MATLAB compresses the image may not be the same that some other program compressed your original image. Don't use JPG anyway. Use PNG format. It's lossless compression and you won't have any of these problems.

댓글 수: 3

Ananthu S
Ananthu S 2016년 10월 30일
Ok.. I got it.. BMP also would work fine, right?
Image Analyst
Image Analyst 2016년 10월 30일
Yes it would.
Walter Roberson
Walter Roberson 2016년 10월 30일
In particular, JPEG will change depending upon the compression parameters that were set. Different programs have different default settings for what JPEG calls "quality"

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

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2016년 10월 30일

댓글:

2016년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by