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

조회 수: 2 (최근 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