How to reverse image without changing the resolution

조회 수: 4 (최근 30일)
N Rh
N Rh 2018년 1월 29일
댓글: Guillaume 2018년 1월 30일
Hi, I used the function fliplr to reverse an image with 300ppp but the image in output is with 72ppp. I want to reverse the image without changing the resolution. The code used is: I = imread(filename); B=fliplr(I); imwrite(B,...);

답변 (2개)

Guillaume
Guillaume 2018년 1월 29일
You need to learn a bit more about resolution and particularly understand that it's mostly meaningless and is only a hint to a program when it prints the image onto paper.
Matlab does not let you set the resolution of images when saved to disk (because it is pointless). Whether you say that the resolution is 300ppp, 72ppp or 1500000ppp, the exact same image is saved. That resolution is just saved as a single number alongside the image.
If your image was scanned at 300ppp, then it is still 300ppp after you've flipped it and saved it.
  댓글 수: 9
Walter Roberson
Walter Roberson 2018년 1월 30일
Text recognition does not depend on the resolution. For example,
Does your ability to OCR those letters depend upon how far away the skywriting is?
Guillaume
Guillaume 2018년 1월 30일
We're going back to my initial statement: "You need to learn a bit more about resolution and particularly understand that it's mostly meaningless."
See this or this for example.
The only important value is the size of the image in pixels. This has not changed. The resolution in ppi or whatever is completely irrelevant. It's just a statement, the same way that I could show you a photo and tell you that photo is at 300 ppi, then show you the same photo and tell you it's at 72 dpi. It's still the same photo.
For image processing, including OCR, what you call resolution is completely irrelevant and not used for anything.

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


Walter Roberson
Walter Roberson 2018년 1월 29일
Resolution is a tag in the image, with the specific tag mechanism depending on the image format. There are no routines provided for writing JPEG or PNG tags, but see https://www.mathworks.com/matlabcentral/answers/349701-overwrite-an-image-with-new-imfinfo-data#answer_275016
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 1월 29일
Also note that with Tiff class, you can have it modify the content of a Tiff image, leaving the tags intact.

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

카테고리

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