Pixopedia_24 Tutorial   Color Twist
  Index page      
  Previous page

Color twisting is a set of actions that performs pixels color modification by means of applying twist color matrix operation.

  Next page
   
   


Color Twist

We will shortly describe the mathematics behind this operation.
Each pixel color value may be represented as a vector with three components: R,G,B. As color twist matrix has dimensions 4x4, we need to modify our color vector which is a matrix of size 3x1 to matrix of size 4x1. We simply ad a value of 1 as a new row value.

Color twisting is actually ordinary matrix multiplication. We will denote our original pixel color vector as P, color twist matrix as C and resulting pixel vector as R. Color twisting is simply: R = C*P

As you will notice in practice, first three columns are directly connected to RGB channels, while last column of matrix is actually bias applied to element resulted from multiplication.

At present time, there are only predefined color twist actions, which you can choose by pressing desired button. In final version, saving and loading user defined color twist filters will be added.

 


Scaling
There are three radio buttons used to set scaling method for color twist matrix. As edit fields of color twist matrix can have floating point values and pixel colors can have only integer values from 0 to 255, we need to scale values of CT matrix.

The first scaling method [-1,1] means that we need rescale this range to [-231, 231 - 1], so the scaling factor is 31. This value is used later for normalization.
In other words, we can only enter numbers in the range [-1,1].

The second scaling mode is used to keep color matrix normalized in the range (-256, 256). In this mode, we usually operate with floating point values in given range.

The third scaling mode is actually mode without scaling, i.e. we operate on integer values in the range: [-231, 231 - 1]

Applying Color Twisting
If you want to apply color twisting on whole image, after choosing the method or entering your own parameters, simply press Image button. Twisting will be applied to whole image.

You can apply color twisting through brush movement, contour and mask as well. For shape selection and brush movement refer to Shapes and Brushes section.

NOTE:
Resultant image is affected by all previously set
Global parameters.

NOTE:
Color twisting is extremely fast when program runs on Intel Pentium processor family, especially on MMX processors.


Example of ColorTwist usage. In the upper left corner is original picture, other pictures show usage of ColorTwist. Click on picture to enlarge.