Data location in a buffer
- The origin is always located in the upper left corner of the image.
- Y axis is directed downward, X axis is directed to the right.
- Width and Height — image dimensions along the X and Y axes. The X axis is always scanned by the "fast" index, i.e. the image is stored in memory in rows along the X axis.
Pixel index in memory for its coordinates is:
index = width * y + x.
Camera orientation options
- Orientation — sets the counterclockwise image rotation. It has four possible values given in degrees: 0, 90, 180, 270.
- requireMirroring — when set to true, the image will be flipped along the X axis (applied after any rotation) before the recognition stage and effect drawing. If the device's frontal camera produces a mirrored image, you should pass it into recognizer with
requireMirroring = false.
- PixelFormat — the camera data binary format. E.g. YUV_420 or RGBA.
Default transformation fits by Height
The default transformation fits Input Frame into Output Surface by Height. It means the Input Frame will be displayed in the Result Frame padded (or cropped) by width.
Custom transformation fits input rectangle inside output rectangle
The custom transformation fits input
image_rect into the output surface (
viewport_rect). The Input image_rect will be inscribed into the viewport_rect by width or height.
The Output Surface may also be flipped by the X or Y axis with
You can also set the custom transformation with
To switch back to using the default transformation, call
set_render_transform with zero-size rectangles.
set_render_transform(pixel_rect image_rect, pixel_rect viewport_rect, flip_x, flip_y);
|image_rect||x, y, w, h||x, y - input rectangle coordinates, w, h - input rectangle size|
|viewport_rect||x, y, w, h||x, y - output rectangle coordinates, w, h - output rectangle size|
|flip_x||true, false||true - flip image by x axis, false - default value|
|flip_y||true, false||true - flip image by y axis, false - default value|