Adjustments

An adjustment is specified by a mode, a direction and a delta. For each reference point and corresponding shift vector, the adjustment is computed and applied. The resulting shift vector is again cached in the warping library. This way of implementation allows incremental adjustments.

Mode defines the way of the distortion. Following modes are available:

  • Parallelogram
  • Trapezoid
  • Pin balance
  • Pincushion
  • Shift
  • Size
  • Rotation (around bitmap image center point)

Direction specifies the direction in which the distortion is applied. Following directions are available:

  • Up
  • Down
  • Left
  • Right

Delta specifies the amount of distortion that is applied. Delta is an unsigned integer value in range 0..255 (1 byte). The delta is added to the existing offset of the corresponding reference points.

Predefined Adjustments

Based on mode and direction, the following transformations are possible:

Mode
Direction
Trapezoid Parallelogram Pincushion Pin balance
Up
drawing-7-1676954059.png
drawing-7-1676954316.png
drawing-7-1676954403.png
drawing-7-1676954492.png
Down
drawing-7-1676954095.png
drawing-7-1676954336.png
drawing-7-1676954419.png
drawing-7-1676954511.png
Left
drawing-7-1676954115.png
drawing-7-1676954356.png
drawing-7-1676954442.png
drawing-7-1676954527.png
Right
drawing-7-1676954131.png
drawing-7-1676954376.png
drawing-7-1676954457.png
drawing-7-1676954547.png


Mode
Direction
Size Rotation Shift
Up
drawing-7-1676954601.png

drawing-7-1676955044.png
Down
drawing-7-1676954905.png

drawing-7-1676955092.png
Left
drawing-7-1676954925.png
drawing-7-1676954990.png
drawing-7-1676955117.png
Right
drawing-7-1676954948.png
drawing-7-1676955009.png
drawing-7-1676955136.png

Formulas for adjustments

The following formulas describe the mathematically necessary adjustments of the reference points. If the requested adjustment exceeds the limit, no calculation shall be done and the previous status will be kept.

Trapezoid mode
drawing-7-1676955237.png
Parallelogram mode
drawing-7-1676955457.png
Pinbalance mode
drawing-7-1676955477.png
Pincushion mode
drawing-7-1676955492.png
Size mode
drawing-7-1676955650.png
Rotation mode
drawing-7-1676955526.png
Shift mode
drawing-7-1676955542.png

NumOfRefPointsX - number of reference points in horizontal direction
NumOfRefPointsY - number of reference points in vertical direction
x[i][j] - x-coordinate of reference point, a 2-dimensional array of floating point variables
y[i][j] - y-coordinate of reference point, a 2-dimensional array of floating point variables



Revision #2
Created 2023-02-21 04:32:28 UTC by Kanai Tomoaki
Updated 2023-02-21 05:00:58 UTC by Kanai Tomoaki