Matlab display images oriented by 180.
18 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Image Analyst
2021-9-8
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 个评论
Julius Muschaweck
2022-10-12
Here: https://magnushoff.com/articles/jpeg-orientation/ is a nice and comprehensive explanation of the orientation tag values. Image taken from there:
Steven Lord
2022-10-12
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!