How can I rotate a series of photos to a desired orientation without knowing the initial orientation of each photo?
9 ビュー (過去 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.
0 件のコメント
回答 (2 件)
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:
0 件のコメント
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 件のコメント
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
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!