How can I rotate a series of photos to a desired orientation without knowing the initial orientation of each photo?

6 次查看(过去 30 天)
I have a large photo folder full of photos and need to orient them all in the same direction. They all have a tube in the picture that needs to be going to the left side of the photo. I would like to locate the position of the tube and then orient the photo with respect to that.

回答(2 个)

Kristen Amaddio
Kristen Amaddio 2017-7-28
The Image Processing Toolbox could help you with this. If all of your images contain the same tube at different orientations, but you want to rotate them all so the tube is at the same orientation in all images (i.e. the left side of the photo), you could try using image alignment.
The following example in the MATLAB documentation could help you with this:
Basically, you could choose one image to be the 'target' image, the image with the orientation you desire all of your images to have. You might need to orient this one manually with imrotate depending on your use case. Then, you could use alignment in order to transform and rotate the other images to match the same orientation.
If you have the Computer Vision System Toolbox, you could also try something similar to the following example:
Take a look at other Image Processing Toolbox examples for more information about image registration, segmentation, and other tools that could help you with this workflow:

Image Analyst
Image Analyst 2017-7-28
Segment out the tube and ask regionprops() for the orientation. If the orientation angle is not right, then call imrotate() to rotate the image 90 or -90 degrees. Pretty easy but attach your image if you need more help. Or see my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
  2 个评论
Haley Albers
Haley Albers 2017-7-31
So your tutorial was pretty helpful but I have a further question...if I have the segment that I need to orient distinguished, how do I call that specific segment? I attached an image that might be helpful. I need to rotate the tube.
Image Analyst
Image Analyst 2017-7-31
Rotate the tube and have nothing else in the image rotate? If so, why?
You'd have to define your center of rotation first. Then rotate the image and the ROI mask both about that point. Then use the mask to replace the original pixels in the rotated mask with the rotated pixels

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by