Matlab display images oriented by 180.
18 views (last 30 days)
Show older comments
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.
0 Comments
Answers (3)
Image Analyst
on 8 Sep 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
0 Comments
Julius Muschaweck
on 12 Oct 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
on 12 Oct 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
- 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.
0 Comments
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!