MATLABで画像表​示するときに画像が横​向きになってしまうの​を直したい

スマホで撮影した写真をMATLABで表示した際に,横向きになってしまい,スマホで撮影した写真のまま表示させたいと考えています.
 
何か良い方法があれば教えていただきたいです.
よろしくお願いします.

 채택된 답변

Kojiro Saito
Kojiro Saito 2022년 12월 15일

3 개 추천

スマホの画像にはEXIFのメタデータが含まれるので、Orientationの値を見て縦向き(6)だったらimrotateする方法でうまくいくと思います。
imageFile = 'IMG_xxx.jpg';
img = imread(imageFile);
% Get image meta information
info = imfinfo(imageFile);
% If an image is jpeg and contains exif
if isfield(info, 'Orientation')
if info.Orientation == 6
img = imrotate(img, -90);
end
end
imshow(img)

댓글 수: 2

大輝 隅岡
大輝 隅岡 2022년 12월 19일
回答ありがとうございます.
無事解決できました.ありがとうございました.
Kojiro Saito
Kojiro Saito 2022년 12월 19일
解決して良かったです。

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

질문:

2022년 12월 15일

댓글:

2022년 12월 19일

Community Treasure Hunt

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

Start Hunting!