GSoC: proposal for transformation tool

Marc pe.marc at free.fr
Tue Apr 6 23:36:15 CEST 2010


Right, I did as Sven said. You're also right concerning KoShape, it
seems that I read the current transformation tool code a little too
fast.

>Also not that there is existing code for 3d transformations of layers
in Krita which you might be able to reuse

Will do, thanks :).
Anyway, unless some still has some remarks to make, this will be my
final proposal :

Title: Image Tranformation Tool for Krita

Abstract:

Since Krita is to be used also for shading and texturing, there are some image transformations that it needs to provide. Indeed, a professional even reported that, for texturing, image manipulations were the most basic and important tools used.

While Krita already covers most of the essential features concerning color correction, layering, and painting, the current image transformation tool lacks crucial features such as shearing image, changing image perspective, or warping image (plus some pre-written transformations using warping).
What's more, the current tool shows some problems in conception : the transformation process is done each time the user rotates or scales the selection, which deterioriates the image each time a little bit more. The tool should work and perform each transformation on a temporary low quality representation of the selection, and perform the complete transformation on the initial selection only once.
Ultimately, the current transformation tool is not functional nor ergonomic : a tool like that needs to have shortcuts, key modifiers, and some buttons (even if it is just a few) to facilitate its use. 

Hence the aim is to develop from scratch a new transformation tool for krita, which will be at the same time fast, quite exhaustive, and comfortable to use.

Implementation :

-First, I will focus on rewriting from scratch the current transformation tool (only the code for the already-existing scale and rotation transformation will likely be re-used), so that it keeps the original shapes of the selection, and records all the modifications done by the user (basically this will be done by updating a QMatrix at each step). When the user is finished with the transformation, the tool will then apply the complete resulting operation on the original shapes, which will replace the current ones.

-Then, I will add the shear transformation (which will be immediate from an algorithmic point of view, since it is simply a linear transformation that Qt can perform for us using a QMatrix). To shear the image, the user will only have to hold a key modifier and click on the side he wants to move. I will also add a center for the rotation, which can be moved by the user.

-Then comes the "change perspective" transformation, which it cannot be done using a 2x2 matrix like QMatrix, but by using a 3x3 matrix and projecting the coordinates on the plan of the screen. Fortunately Qt provides a QTransform class to work with 3x3 matrices, so perspective transformations won't be a problem. In Krita the user will be able to rotate the image around an x axis and around an y axis by holding a key modifier and moving the mouse (movement in the x direction will perform a rotation around the y axis and vice versa).

-Afterwards, I will implement warping. Warping enables the user to transform the image by modifying some of its points : a grid is displayed temporarily on the selection and the user moves its intersection points to deform the image. This will likely take a great amount of time in proportion to the other transformations. It is really a challenge from an algorithmic point of view : it is not a linear transformation, and thus cannot be done simply by multiplying matrices. So first i will have to do some research, read some papers to come up with an algorithm. Implementing the interface will also be quite challenging.

-Finally I will add some pre-written transformations using warping transformations.

Some details about how the user will use the different transformations on this scheme :
http://dl.free.fr/bUw3Loddg
And a mockup for the Tool Options widget :
http://dl.free.fr/qqX3RkbjD

Timeline :

Although my exams finish the 21th of May, I will still have to work on a project for school until the 11th of June (but then I will be entirely free until september). Hence, I would start working on my transformation tool before the official beginning of the Google Summer of Code, in parallel of school.
This would be a preliminary schedule :
Apr 20 - I start right away with rewriting the current transformation tool.
May 3 - The tool should be rewritten, enabling like before the user to rotate and scale the image. I will be taking 10 days to prepare for the exams. My exams will then take 10 days. Afterwards I will have 3 weeks to work on a project which will close the school year.
June 14 - implement the shear transformation and the change perspective transformation (1-2 weeks).
June 28 - work on the details of the interface to have something polished for the midterm evaluation (1 week).
July 5  - begin the work on the warping transformation. The investigations will likely take about 1 week and the implementation of the algorithm and the interface will take easily 2 weeks.
July 26th - polish the interface, bug corrections, adding pre-written transformations using warping (until the pencils down date).
August 9th - pencils down date

About me :

I am a first-year french student in a school of engineering (Ensimag : National Superior School of Computer Science and Applied Mathematics). I have been using essentially open source programs for approximately 5 years now, and, since January, i have made several small contributions for Krita (for example i fixed/added the local selections). Thus, I am already familiar with krita's code.
I have grown an interest in image manipulation and transformation since last year, while I was working on image resizing techniques and basic edge detection methods for a school project last year. This project resulted in a small program written in Qt, which means I am comfortable using Qt and C++, and I am not afraid to read scientific algorithmic papers which may be needed to complete my project.

Le lundi 05 avril 2010 à 11:14 +0200, Boudewijn Rempt a écrit :
> It's basicallyt a good proposal, but as Sven said, 
> investigatehttp://doc.qt.nokia.com/4.6/qtransform.html, and don't mention 
> KoShape here: it's irrelevant. Also not that there is existing code for 3d 
> transformations of layers in Krita which you might be able to reuse.
> 




More information about the kimageshop mailing list