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

2 ビュー (過去 30 日間)
Zara Khan
Zara Khan 2018 年 6 月 21 日
コメント済み: Zara Khan 2018 年 6 月 24 日
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 .
  2 件のコメント
Guillaume
Guillaume 2018 年 6 月 21 日
How do you define the orientation of your image? Is it based on the content of the image (e.g. there's a line in the image) or simply on the size of the image (i.e it's taller than wide)?
Zara Khan
Zara Khan 2018 年 6 月 21 日
I am finding images orientation by regionprops

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2018 年 6 月 21 日
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
  8 件のコメント
Image Analyst
Image Analyst 2018 年 6 月 23 日
You may have to put in some ad hoc code to recognize and handle pathological image, like ones that are too roundish. For example you may have to track the angle across frames and do something special if the angle changed too much from one frame to the next. Sorry, I can't write a turnkey and robust gesture recognition system for you - it's just way too much work.
Zara Khan
Zara Khan 2018 年 6 月 24 日
okey. Thank you for your time and response.

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2018 年 6 月 21 日
Use imrotate() with the Orientation angle given by regionprops().
  4 件のコメント
Matt J
Matt J 2018 年 6 月 21 日
Zara Khan commented:
I have already accessed and loaded them in matlab. But each image having different orientation and then how it will be possible to set all them to vertically align ? It is possible through a code ?
Matt J
Matt J 2018 年 6 月 21 日
You loop through them and apply regionprops and imrotate to each one separately.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by