I rotated images in preview (mac), but Matlab views original images

1 次查看(过去 30 天)
Hi
I have tousands if images rotated in preview (mac). I didnt know, what exif is and that some programs - like matlab - view the original, not rotated images. I am trying minimize the damage and I am looking for a fast solution to rotate the images in matlab.
I've tried:
imfinfo('image.jpg')
struct with fields:
Filename: 'image.jpg'
FileModDate: '12-Apr-2021 19:34:46'
FileSize: 41389
Format: 'jpg'
FormatVersion: ''
Width: 612
Height: 1101
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
Orientation: 8
XResolution: 72
YResolution: 72
ResolutionUnit: 'Inch'
YCbCrPositioning: 'Centered'
DigitalCamera: [1×1 struct]
so there is information about the orientation. What does the 8 mean?
If i rotate this image, the 'Orientation' information disappears.
xx = imrotate( image , 90);
imshow(xx)
imwrite(xx, 'test.jpg')
imfinfo('test.jpg')
Filename: 'test.jpg'
FileModDate: '16-Apr-2021 12:18:34'
FileSize: 42262
Format: 'jpg'
FormatVersion: ''
Width: 1101
Height: 612
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
Can I change the 'Orientation' or do something with it to make the images be rotated like in Preview?
Best,
Dawid
  2 个评论
Jan
Jan 2021-4-16
"If i rotate this image, the 'Orientation' information disappears." - No, this information vanishes, if you write the image to the disk.
"I have tousands if images rotated in preview (mac)" - What does this mean? I'm not sure if I understand, what your current situation is. Yout can rotate images in the preview of the operating system? Then MacOS writes "8" as orientation? Which value is found there, if you rotate in another direction?
So what exactly are the data you have and what do you want to achieve? What is the relation of your problem to Matlab?
Rik
Rik 2021-4-16
If you want to rotate the actual images themselves, why don't you do that? You can use the orientation property to find out how you need to rotate or flip the image. It takes some experimentation, but it isn't hard.

请先登录,再进行评论。

采纳的回答

Dawid Strzelczyk
Dawid Strzelczyk 2021-4-16

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by