MATLAB: How it is possible to change all images orientation to same i.e. to vertical

digital image processinggesturehandimage processingImage Processing Toolboxsign language

My folder consisting of 1000 binary images with different orientation. I want to make all of them to vertically align. How it will be possible through a single code ? Later I want to save all the vertically aligned images to a new folder. Note:few images are already in vertical orientation . I want to keep them as it is .

Best Answer

regionprops() is not needed. Simply use size(). Rotate if the image is wider than tall:
[rows, columns, numberOfColorChannels] = size(yourImage);
if columns > rows
yourImage= imrotate(yourImage, 90);
end