Why is a resaved JPG file different from the original?

조회 수: 1 (최근 30일)
Osama AlThahab
Osama AlThahab 2013년 8월 20일
when i read any image and then write it without any modification then read it again i found that the mattrix of them not equal there is a difference between them.
f=imread('lena.jpg');
imwrite(f,'lena1.jpg');
f1=imread('lena1.jpg');

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 20일
JPEG is a lossy image compression format, and the amount of loss can be adjusted. The loss settings that were used to create the image might not be the same loss settings that are used by default when you imwrite() a JPEG image, so the imwrite() / imread() combination might be throwing away more information than was thrown away to create the original lena.jpg file.
Also notice that your code has you reading the same file twice :)
  댓글 수: 3
Image Analyst
Image Analyst 2013년 8월 21일
The answer is the same. You're saving to a lossy format so information is lost. Thus you won't read in the same data as before the save. Save to lossless PNG format instead and you'll be okay.
Osama AlThahab
Osama AlThahab 2013년 8월 21일
thanks alot

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by