face detection - auto-rotate scanned slides?

How fussy is Digikam’s face detection with respect to rotated images?
Is there a setting for face detection that will find rotated faces (even upside down)?

Is it possible to use Digikam’s face detection to auto-rotate scanned slides to the correct orientation?

I’m trying to process my uncle’s slide collection. My cousin scanned in decades of slides, but the orientation of the slides is somewhat random…

The face detection AI model in digiKam isn’t overly sensitive to rotated images, but it does make a difference.

I would recommend using the Batch Tool in digiKam to rotate the images so they have the correct orientation. Yes, this can be a bit tedious. First, select all images that are rotated 90 degrees to the left. You then feed these to the Batch Queue Manager, and use the rotate tool on those images. Then do the same for all images rotated 90 degress to the right.

It’s a little easier than rotating each image individually.

Cheers,
Mike

I’m dealing with scanned slides, where the rotation/orientation is pretty random. That is, it would be a fully-manual thing to look at a scanned image to figure out is it’s rotated left/right/upside-down… Is there a way of tapping into some face detection parameter to auto-rotate scanned slides to the correct orientation?

Hi @sinkva ,
That’s a really great idea. While it doesn’t exist in digiKam now, I already started looking at open source AI models that can detect rotation. Maybe I can get something in to digiKam for our 8.7.0 release. We’re about 1 week away from releasing 8.6.0, so it won’t be in our next release.

I don’t know how much of a geek you are, but if you’re like me, then this might be interesting: GitHub - pidahbus/deep-image-orientation-angle-detection

Cheers,
Mike

Being able to detect (and fix) rotation would IMHO be a game-changer for at least three use cases that I’ve encountered:

  • scanned slides/film strips, especially since slides are square and the person scanning eventually says (w/r/t proper rotation) “Geez, we’ll fix it later”. Anything from a film camera…
  • scanned prints – I once agreed to digitize a shoebox full of a mix of 4x6 and 5/7 prints.
  • images from a flatbed scanner. OCR apps do pretty well w/r/t finding text and rotating the scanned result, but without text it’s back to manually rotating.

These use cases only need to decide on 0 degree, +/- 90 degree, or 180 degree rotation. Would that simplify things at all?
Or have different modes, one for optimized free-rotation and one for 0 degree, +/- 90 degree, or 180 degree rotation.

If you can get a rudimentary image rotation/correction capability into the 8.7.0 release, that would be incredibly awesome.

I’m aready working on a prototype. First, I split the circle into four 90 degree arcs: 315-45, 45-135, 135-225, 225-315.

I then shrink each arc by 30 degrees, taking 15 degrees off each end. The “empty” space between the arcs is “error space” and I don’t know which way to rotate, if at all, so I do nothing.

Now I have 4 arcs, depending on what AI tells me:

  • 330-30 - Do nothing - Image is close to correct
  • 60-120 - Rotate 90 degrees
  • 150-210 - Rotate 180 degrees
  • 240-300 - Rotate 270 degrees

Eventually, the “error space” will be configurable in the UI just like a face accuracy slider, allowing the user fine control over when and when not to rotate the image. This is for people who love artistic angles.

Cheers,
Mike

1 Like

You’re my hero!

1 Like

Quick update for you, @sinkva. I have a working prototype of the auto-rotate tool. I tested the AI model, and it works well. I converted the model to something digiKam can use, and updated the sample to use the same vision framework as digiKam. The last step is to create a new digiKam Auto-Rotate Batch Queue tool, which should take a day or two.

Unfortunately, we’ve frozen the code base in preparation of the upcoming 8.6.0 release, but the rest of the team loves the idea, so the auto-rotate tool will definitely be in 8.7.0. We typically start doing daily builds for the next release about a week after a release, which means you could start using the tool by the end of March or early April.

Cheers,
Mike

Looking forward to testing out the new auto-rotate tool!