Last active
August 29, 2015 14:15
-
-
Save dzonesasaki/2db1a6896ad432f2d531 to your computer and use it in GitHub Desktop.
rotation using exif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function imgOut = myimgrotexif(imgIn, exif) | |
InfoOri = exif.Orientation; | |
dicRot = [0,0,2,2,1,1,3,3]; | |
dicFlip = [0,1,0,1,1,0,1,0]; | |
[sYorg,sXorg,sDepth] = size(imgIn); | |
if(sDepth>1) | |
for uilp =1:sDepth | |
imgOut(:,:,uilp)=rot90(imgIn(:,:,uilp),-dicRot(InfoOri)); | |
if(dicFlip(InfoOri)==1), imgOut(:,:,uilp)=flipud(imgOut(:,:,uilp));endif | |
% flipud or fliplr .... | |
endfor | |
else | |
imgOut=rot90(imgIn,-dicRot(InfoOri)); | |
if(dicFlip(InfoOri)==1), imgOut=flipud(imgOut);endif | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment