data differs by using imwrite

조회 수: 2 (최근 30일)
Parul
Parul 2014년 2월 14일
답변: David Young 2014년 2월 14일
I have a Mat Image file,when i store the same image variable into the disk using imwrite and then access it using imread , the data are totally different, as i know , imwrite scales the input data, but i don't see any scaling in it. i have to use that variable for further use, which form i should take, before imwrite, or after imwrite.

채택된 답변

David Young
David Young 2014년 2월 14일
If you are saving the image as a JPEG, or in any other compressible format, then there might be data loss on writing which could cause a difference between the input and the output. How different is "totally different"? If there really is no relation, check that imwrite and imread are really using the same pathname.
One solution would be to use save and load rather than imwrite and imread - that way the data will be returned exactly unchanged.
I am not sure what you mean in your last sentence. Normally, if you are going to use the value of a variable in the same program, you do not need to write and read it at all. If you want to save the value at some stage, calling imwrite will not change the value.
You may need to post your code to clear this up.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by