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

3 views (last 30 days)
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 .

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 21 Jun 2018
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);

Sign in to comment.

More Answers (1)

Matt J
Matt J on 21 Jun 2018
Use imrotate() with the Orientation angle given by regionprops().
Matt J
Matt J on 21 Jun 2018
You loop through them and apply regionprops and imrotate to each one separately.

Sign in to comment.


Find more on Image Processing and Computer Vision 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!