MATLABで画像表示するときに画像が横向きになってしまうのを直したい
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
スマホで撮影した写真をMATLABで表示した際に,横向きになってしまい,スマホで撮影した写真のまま表示させたいと考えています.
何か良い方法があれば教えていただきたいです.
よろしくお願いします.
0 commentaires
Réponse acceptée
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur イメージ算術 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!