GSoC: proposal for transformation tool

Marc pe.marc at free.fr
Sat Apr 3 23:52:04 CEST 2010


Hi,
here is the first version of my proposal for a new transformation tool
for krita. I'd like some comments !

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 won't be as
easy as shearing : since it is not a 2D transformation, it cannot be
done using a 2x2 matrix like QMatrix. However, such a transformation can
be done using a 3x3 matrix, and projecting the coordinates on the plan
of the screen. Perhaps the best way to implement it is to change
directly the KoShape class to accept 3D transformations. Thus, this may
take some time : I will have to create a 3x3 Matrix class with basic
operations such as multiplication, inversion, determinant and
changePerspective, and then write the methods for 3D transformations in
KoShape. 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).

-Finally, 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.

-If i have some time left, I will add some pre-written transformations
using the warping transformation.

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 11 - implement the shear transformation and the change perspective
transformation (2 weeks).
July 2 - work on the details of the interface to have something polished
for the midterm evaluation.
July 9 - 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 30th - polish the interface, bug corrections, adding pre-written
transformations using warping (until the 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.



More information about the kimageshop mailing list