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

10 vues (au cours des 30 derniers jours)
大輝 隅岡
大輝 隅岡 le 15 Déc 2022
Commenté : Kojiro Saito le 19 Déc 2022
スマホで撮影した写真をMATLABで表示した際に,横向きになってしまい,スマホで撮影した写真のまま表示させたいと考えています.
 
何か良い方法があれば教えていただきたいです.
よろしくお願いします.

Réponse acceptée

Kojiro Saito
Kojiro Saito le 15 Déc 2022
スマホの画像には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 commentaires
大輝 隅岡
大輝 隅岡 le 19 Déc 2022
回答ありがとうございます.
無事解決できました.ありがとうございました.
Kojiro Saito
Kojiro Saito le 19 Déc 2022
解決して良かったです。

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!