digiKam

Professional Photo Management with the Power of Open Source

New ‘auto-correction-mode’ for the Free Rotation image plugin

by Andi Clemens

A few weeks ago I added a new feature to the Free-Rotation imageplugin: 'Automatic (Horizon) Correction'.

digiKam - FreeRotation auto mode

This is nothing new, Gimp and Photoshop (and for sure other applications) have such a feature, too.
You set two points in the preview widget and hit "Adjust" to rotate the image accordingly to these markers.

The difference is that it is suitable to adjust horizontal and vertical lines and determines automatically which of the modes it should use, based on
the angle between the two marker points. Also the rotation direction is detected by the plugin, so that it is actually quite easy to use, you do not have to
say if you want to rotate clockwise or counter-clockwise.

The user interface could be better, for example it would be nice to have zooming capabilities for better marker control. But right now it is not possible with the
current preview widget implementation (we are working on it... :-)).

Thanks for this new feature!

Thanks for this new feature! I find it to be very useful and will likely use this alot.

Just love it

I noticed this feature when you added it to SVN and I just like it. I was thinking should it be more automatic feature where you just select the tool and you drag a line, but it makes harder to select correct points what this allows. And it is nice that buttons then show the pixel position of points. :-)

I don't know if the point

I don't know if the point coordinates are really that necessary, but well right now they are displayed :-)
I had planned to simply drag a line over the preview, but with current preview widget it is not possible and the points are already a "dirty" hack.
When we re-design the preview widget to have a canvas, those points will be draggable (or I will go with the line implementation, don't know now).

Andi

I like the general idea. I

I like the general idea. I use digiKam more and more for photo editing these days and only "bring out the GIMP" on special occasions, so I welcome any features that reduce the amount of switching between applications that I have to do. Keep up the good work.

Here are some other observations:

The point coordinates are probably useful for fine-tuning, but I don't like the "Click to set" button. Surely there is room to just put the values in text boxes and allow the user to change them directly?

Can the image be zoomed while positioning the lines?

I assume the automatic correction to vertical or horizontal orientation works by figuring out if the line is more or less than 45 degrees from the horizontal. If that is so, it assumes that the picture has already been rotated to the correct orientation before the finer adjustment to the rotation is made. Perhaps an option to override the automatic adjustment would be useful for some whose cameras do not have an orientation sensor and whose images do not get rotated automatically.

Lastly, if instead of allowing just one line to indicate what should be horizontal or vertical you allowed a second, optional line, you could use the same feature to perform perspective correction. For example, in the photo of the church, you could put two vertical lines on either side and have the rotation and perspective corrected at the same time. (Perhaps the perspective correction would allow you to indicate just how much correction you want.) Combining the two features would make it easier to make a single decision about the required cropping.

> The point coordinates are

> The point coordinates are probably useful for fine-tuning, but I don't like the "Click to set" button.
> Surely there is room to just put the values in text boxes and allow the user to change them directly?
> Can the image be zoomed while positioning the lines?

Right now the button solution is the easiest way to set two points, because we don't have a canvas for the preview widget where it would be possible to drag the points / line around. Also the plugin doesn't use zooming at the moment, so chances are that when clicking in the preview widget, you don't set the point precisely. This is why we use buttons at the moment. You can adjust your selection until it is perfect, then hit the button to set a marker point.
I guess this will be changed when we use a new preview widget some day.
The coordinates are actually totally useless, you can use the two sliders for fine-tuning the angle. I guess I will remove the coords again.

> I assume the automatic correction to vertical or horizontal orientation works by figuring
> out if the line is more or less than 45 degrees from the horizontal. If that is so, it
> assumes that the picture has already been rotated to the correct orientation before the finer
> adjustment to the rotation is made. Perhaps an option to override the automatic adjustment would
> be useful for some whose cameras do not have an orientation sensor and whose images do not get rotated automatically.

Right, alignment is determined by the angle between the two marker points.
If your image is not rotated correctly, you can do so by using the sliders. Auto-rotation will work on already rotated images.
Let's say the image is rotated to the right, you can use the following workflow:

1. Roughly rotate the image to the left by using the sliders.
2. Finetune the rotation by settings the marker points on the horizon
3. Click "Adjust" to set the new angle.
4. If it's still not aligned perfectly (although I doubt that :-)), you can use the sliders again to rotate to your liking.

> Lastly, if instead of allowing just one line to indicate what should be horizontal or vertical you
> allowed a second, optional line, you could use the same feature to perform perspective correction.
> For example, in the photo of the church, you could put two vertical lines on either side and have the rotation
> and perspective corrected at the same time. (Perhaps the perspective correction would allow you to indicate just how
> much correction you want.) Combining the two features would make it easier to make a single decision about the required cropping.

Maybe I misunderstood this, but we have a perspective correction tool. It should do what you are describing here.

Andi

The coordinates are actually

The coordinates are actually totally useless, you can use the two sliders for fine-tuning the angle. I guess I will remove the coords again.

It would probably make things simpler.

Auto-rotation will work on already rotated images. [...]

I assumed wrongly, then. That sounds perfect.

Maybe I misunderstood this, but we have a perspective correction tool. It should do what you are describing here.

No misunderstanding; I haven't used the perspective correction tool before. I don't know what it looks like and haven't got access to digiKam at present to take a look. It just struck me that drawing one line for rotation correction and two lines for some perspective correction could be handled in a similar manner and might be rolled into one feature. Of course you'll need four lines to correct perspective fully and then you'll have what GIMP has. Does digiKam have the same? Given that rotation and perspective correction both require some cropping and anti-aliasing, I thought it would be easier to combine the two operations given that they can be performed in a similar manner.

Feel free to dismiss my ramblings.

(Have to run the CAPTCHA gauntlet now. It normally takes me several attempts to get it right.)

Woohoo! I recognize that

Woohoo! I recognize that photo! Jerónimos Monastery, in Lisbon! Hope you've had a good time here! Keep the innovations coming, man! You (the Digikam devs) rock really hard!

Best wishes! =D

Pedro

I have not taken this photo,

I have not taken this photo, and actually I didn't want to use it for the demonstration, because I don't have rights for the image.
Somehow I messed this up, I'm pretty sure I had another image of mine loaded before as I started to do the animation.
The image is from our test image repository, I hope whoever took it is ok with that.
If you recognize your photo, please answer here so we can have the correct credits.

Andi