Matlab display images oriented by 180.

15 visualizzazioni (ultimi 30 giorni)
Yuzhen Lu
Yuzhen Lu il 8 Set 2021
Risposto: Steven Lord il 12 Ott 2022
I am using imshow to display an image. It is found the image rotated by 180 . When I look at the meta by imfinfo. there is an orientation field with value 3.
Orientation: 3
From this post, it is the orienttion tha results in the oriented diplay of an image. But I did not find relevant documentation about the orientation. How is the value related to image display. Any links to the official documentation are welcome.
Is the orientation value defined during the image collection process? The image was capatured by an iphone camera. Some other images have an orientation value of 1 (i.e., no orientation). But I haven't orientation equal to the values other 1 and 3. I don't know how these values are related to image aquistion (and or cameras).
I was wondering if imshow can suppress the orientation, display the images as viewed by regular Windows viewer.
I also tried displaying the same image using python skimage.io. The associated functions imread and imshow can diplay the image without orientation.

Risposte (3)

Image Analyst
Image Analyst il 8 Set 2021
Here's a snippet from my program:
[imageArray, colorMap] = imread(fullImageFileName);
% colorMap will have something for an indexed image (gray scale image with a stored colormap).
% colorMap will be empty for a true color RGB image or a monochrome gray scale image.
% The orientation should be 1. If the orientation is 3, the image is upside down and needs to be rotated.
info = imfinfo(fullImageFileName);
hasField = isfield(info, 'Orientation');
if hasField
if info.Orientation == 3
imageArray = imrotate(imageArray, 180);
end
end

Julius Muschaweck
Julius Muschaweck il 12 Ott 2022
Here: https://magnushoff.com/articles/jpeg-orientation/ is a nice and comprehensive explanation of the orientation tag values. Image taken from there:

Steven Lord
Steven Lord il 12 Ott 2022
Is the image rotated by 180 degrees, or is it flipped top to bottom? The imshow function calls image which states (in part) in the More Info section of its documentation page
"The high-level version of image calls newplot before plotting and sets these axes properties:
  • Layer to 'top'. The image is shown in front of any tick marks or grid lines.
  • YDir to 'reverse'. Values along the y-axis increase from top to bottom. To decrease the values from top to bottom, set YDir to 'normal'. This setting reverses both the y-axis and the image.
  • View to [0 90]."
See the second bullet.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by