Lulumoy Studio

Math guide

Coordinate system and rulers

In Lulumoy Studio, as in OpenCV, positions in an image are measured in pixels from the top-left corner: the x axis grows to the right and the y axis grows downwards. The rulers around the image show exactly these coordinates.

Pixels

P(x,y)=[x,x+1)×[y,y+1),x∈{0,…,W−1},y∈{0,…,H−1}
A W×H image has W columns and H rows. The pixel in column x and row y covers the unit square P(x, y); the ruler ticks are on its edges, x = 0, 1, …, W and y = 0, 1, …, H.

From the screen to the image

x=uz,y=vz,(x,y)↦(⌊x⌋,⌊y⌋)
(u, v) is the mouse position over the displayed image, in screen pixels, and z the zoom (z = 1 at 100 %). The status bar shows pixel (⌊x⌋, ⌊y⌋) and its value; the clicks of the affine and perspective transforms use (x, y) with decimals.

Values

I(x,y)∈{0,…,M},M=2b−1∈{255,65535}
Each channel stores an integer between 0 and M, with b = 8 or 16 bits per channel. In colour, the value is a triple (R, G, B) or, with transparency, (R, G, B, A); OpenCV stores them in the order B, G, R.

At 800 % zoom or more, the program also draws the pixel grid: each cell is one of the squares P(x, y).

See also: Crop, Affine transform (3 points), Interpolation and borders

References

  1. OpenCV 4.x documentation — Geometric Image Transformations (warpAffine, warpPerspective, getAffineTransform, getPerspectiveTransform, getRotationMatrix2D, interpolation flags). docs.opencv.org/4.x/da/d54/group__imgproc__transform.html
  2. R. C. Gonzalez, R. E. Woods. Digital Image Processing, 4th ed. Pearson, 2018.