How to reverse image without changing the resolution
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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,...);
0 commentaires
Réponses (2)
Guillaume
le 29 Jan 2018
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 commentaires
Walter Roberson
le 30 Jan 2018
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
le 30 Jan 2018
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."
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
le 29 Jan 2018
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 commentaires
Walter Roberson
le 29 Jan 2018
Walter Roberson
le 29 Jan 2018
Also note that with Tiff class, you can have it modify the content of a Tiff image, leaving the tags intact.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!