# kuvio_image

## Public Attributes

kuvio_image_type type
int width
int height
size_t stride
kuvio_refcount ref_count
int shared_data
void* data
int channel_min
int channel_max
kuvio_coordinate_frame world_frame
kuvio_coordinate_frame camera_frame
kuvio_camera_parameters calibration_data
struct kuvio_image* source
void(* destroy)(struct kuvio_image*)

## Detailed Description

An image.

The image structure describes the format of the image and contains a pointer to the start of image data. Images are always stored in row-major order: the data pointer points to the upper left pixel, data + 1 to the pixel to the right of it and data + stride to the beginning of the row below the first one.

The image structure always contains calibration data and a coordinate frame that can be used to map the image to the physical world. This makes it possible to always make measurents in world units (e.g. millimeters) and to easily relate images to each other without using side channels to pass location information. For example, the exact location of a subimage within the original is always known because both images know their location with respect to the world.

## Member Data Documentation

kuvio_camera_parameterskuvio_image::calibration_data

Camera calibration data.

kuvio_coordinate_framekuvio_image::camera_frame

Camera coordinate system position with respect to world frame. This frame is obtained by inverting world_frame. It is stored in the image to avoid inverting the world frame repeatedly. Use the kuvio_image_set_world_frame() function to set both frames at once.

int kuvio_image::channel_max

The maximum value a color channel in the image can take. Usually, this value is 255 for kuvio_gray8_image_type, but it may be less (e.g. 1 in binary images). If a 10-bit camera is used, channel_max is 1023 even though kuvio_gray16_image_type would allow values up to 32767.

Note that the image may or may not actually contain this value. For example, a binary image (channel_max = 1) may contain just zeros.

int kuvio_image::channel_min

The minimum value a color channel in the image can take. With the kuvio_gray8_image_type, this is always zero. With other gray-level types, channel_min can take a negative value.

Note that the image may or may not actually contain this value. For example, a gray-level image may have no black pixels.

void* kuvio_image::data

Pointer to data (upper left corner).

void(* kuvio_image::destroy)(structkuvio_image*)

Destructor function. Depending on how the image data was originally allocated, it also needs to be deallocated differently. If destroy is non-null, it will be used instead of shm_free() when deallocating a kuvio_image.

int kuvio_image::height

The number of rows in the image.

kuvio_refcount kuvio_image::ref_count

The number of references to this image structure.

int kuvio_image::shared_data

If non-zero, data is shared and must not be altered.

struct kuvio_image* kuvio_image::source

Pointer to source data, if this is a subimage.

size_t kuvio_image::stride

The number of bytes between the starts of successive rows. If the image is compressed, stride tells the size of the compressed data in bytes.

kuvio_image_typekuvio_image::type

The type of the image.

int kuvio_image::width

The number of columns in the image.

kuvio_coordinate_framekuvio_image::world_frame

World coordinate system position with respect to camera frame.