Home > Software design >  How to automatically rotate images based on text?
How to automatically rotate images based on text?

Time:11-03

I am currently working on my eagle project for boy scouts. We are taking pictures of graves to preserve family's pasts but these pictures have been saved in google drive initially meaning that the EXIF information is lost. I need to go through around 3000 photos and see which direction they need to be rotated and do that rotation not through EXIF but rather by saving the actual pictures as the correctly oriented version of themselves. I have some experience in java but not much and will be open to solutions in any language as long as there is some description of how to import the correct libraries. Not all the photos are turned the same way and some are upsidedown so I need a way for the program to understand which direction the words are oriented in and from there I need to rotate them. If you can only find the angle they are rotated at I know a way to actually do the rotations. Here are some examples of the pictures I have. Here are some test cases left rotate, upsidown, right rotate, correct orientation

Thanks for any help

CodePudding user response:

First you must detect the objects which is charecters in your case and there are many pre-trained object detectors for your data, Secondly you are going estimate the rotation from the detected object to the correct position of the charecter in general.

CodePudding user response:

Honestly, the best way will be... by hand (an automated solution will be very hard and extremely time consuming).

Write a short program that presents the images one after another and lets you apply the correct rotation with a single keystroke (all pictures first set to landscape orientation*). 3000 photos can be processed in one or two hours, much faster than programming an application that will cause many false decisions, taking more time to fix.

Possibly even faster, show multiple thumbnails at a time and let the user click on the mis-oriented ones (like single click = 180° rotation, shift/ctrl-click for ±90°). My bet is that you can reduce the processing time to a quarter.

Finally, the poor man's solution is by using the File Explorer and right-click to Rotate left or Rotate right. [Not kidding this will be globally the fastest.]

*For pre-rotation of the portrait images, consider a sample of images to see which among left or right rotation is most often required.

  • Related