How can I rotate multi-image files?
Show older comments
I'm working on a project about analysing image data. I have a folder where contains 8 thousands images. Each image file has to be rotated in each specific angle. The angle data are in an excel file. I am a MATLAB beginner, please help me. Here is my code but I don't understand where is wrong. The error message shows 'Subscripted assignment dimension mismatch. Error in ImageRotate newImage(i) = imrotate(I,wd(i));'. I tested it in a director where there is only one gif image and set 'wd = num(2,8);), But I still got the same error message.
%load all images from a directory. AllImageRead.m
myFolder = '/Users/anqili/Documents/MATLAB/gifImage/';
filePattern = fullfile(myFolder,'*.gif');
scrFiles = dir(filePattern);
for k = 1:length(scrFiles)
baseFileName = srcFiles(k).name;
fullFileName = strcat(myFolder,baseFileName);
I = imread(fullFileName);
end
%load rotation angles from xls. WDirection.m
[num,txt] = xlsread('sta_201209_ver18.xls');
wd = num(:8);
%Rotate Images. ImageRotate.m
for i = 1:length(wd)
newImage(i) = imrotate(I,wd(i));
figure, imshow(newImage);
end
Accepted Answer
More Answers (0)
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

