Project

General

Profile

camera interface

Generic camera interface for image acquisition.

Multiple image (multiple out) output ports can be published, organized into individual banks. Each bank contains a number of coherent images, e.g. time synchronized.

The internal architecture implements a graph of named source and sink slots, which can be published individually into images of a bank. Hardware-dependent functions can stream raw data into slots, which can then filtered or otherwise processed by generic services into other slots and eventually published with publish (activity).

Note that the term slot in this documentation always refers to an internal image of the processing graph, while the term bank refers to a published image in a bank of the port image (multiple out).

Ports

image (multiple out)

Data structure
  • struct ::or_image::bank image

    • struct ::or::time::ts ts

      • long sec

      • long nsec

    • sequence< struct ::or_image::frame, 8 > images

      • struct ::or_image::info info

        • unsigned long seq

        • optional< struct ::or::sensor::pixmap_roi > roi

          • unsigned long subsx

          • unsigned long subsy

          • unsigned long x

          • unsigned long y

          • unsigned long width

          • unsigned long height

        • optional< struct ::or_image::distortion > distortion

          • enum ::or_image::distortion_model model ∈ { R3T2 }

          • sequence< double, 8 > coeffs

        • optional< struct ::or_image::intrinsic > intrinsics

          • double fx

          • double fy

          • double cx

          • double cy

        • optional< struct ::or_image::extrinsic > extrinsics

          • struct ::or::t3d::pos T

            • double x

            • double y

            • double z

          • struct ::or::t3d::att R

            • double qw

            • double qx

            • double qy

            • double qz

      • struct ::or::sensor::pixmap pixmap

        • unsigned long seq

        • unsigned long width

        • unsigned long height

        • unsigned long stride

        • enum ::or::sensor::pixmap::encoding pixfmt ∈ { ANY, MONO8, RGB8, BGR8, RGBA8, BGRA8, MONO16, Z32, XYZ32, JPEG, INVALID }

        • sequence< octet > data

Published image banks.

Images in a bank are considered as a coherent set of individual frames, hence sharing a common ts timestamp information.

Each image in the array contains its own metadata information info and a pixmap. The seq member represents a sequence number and different images read from the same bank index with the same seq number should be considered identical. This is especially useful to check if the calibration data has changed.

info.roi indicates that the image data was extracted from a bigger image. In particular, the intrinsics refer to the original image dimensions.

info.distortion represents the image distortion information and the associated correction model.

info.intrinsics is the intrinsic matrix mapping from 2D coordinates to 3D information, according to the following model where u,v are image pixel coordinates, w a free parameter and X, Y, Z 3D coordinates in the camera frame:

| w.u   | fx  0 cx | | X
| w.v = | 0  fy cy |.| Y
| w     | 0   0  1 | | Z

info.extrinsics is a 3D transformation converting 3D coordinates from the camera frame to another frame common to all images in a bank:

| X'     | X
| Y' = R.| Y + T
| Z'     | Z

pixmap.data contain the actual pixel values, arranged as a row-major 2D array of height×width pixels. The width in bytes of each pixel row is indicated by stride.

Each pixel has the format pixmap.pixfmt, defining the number of channels: MONO is 1 integer grayscale channel, RGB or BGR are 3-color integer channels, possibly with an additional transparency channel A. Z and XYZ are 1 and 3 floating point depth channels repectively. The number of bits encoding each channel value is suffixed. JPEG indicates a compressed RGB color image.


Services

publish (activity)

Inputs
  • string<16> slot (default "") Slot name

  • string<16> bank (default "") Published bank name

  • octet index (default "0") Published bank index

Throws
  • exception ::camera::einval

    • string<128> what

Context

Start publishing a named slot in a port.

This exports the internal image slot into the bank port at the position index in the bank.


unpublish (activity)

Inputs
  • string<16> bank (default "") Published bank name

  • octet index (default "0") Published bank index

Throws
  • exception ::camera::einval

    • string<128> what

Context

Stop publishing a port.


jpeg (function)

Inputs
  • string<16> input (default "") Input slot name

  • unsigned short quality (default "80") Compression quality [0-100]

  • string<16> output (default "") Output slot name

Throws
  • exception ::camera::einval

    • string<128> what

Compress a slot using JPEG compression.

This converts the input slot to the output slot output using JPEG compression, with the specified quality.


record_mpeg (function)

Inputs
  • string<16> input (default "") Input slot name

  • unsigned short width (default "640") Image width

  • unsigned short height (default "480") Image height

  • unsigned short fps (default "25") Image height

  • string<128> output (default "") Output file (.avi extension)

Throws
  • exception ::camera::einval

    • string<128> what

Record a slot using MPEG compression in an AVI container.

The input slot is first resized to the desired width and height and compressed into the output file. The playback video frame rate is fixed and equal to fps, no matter the input slot rate. The output file name must end with .avi.

Additionnaly, an output slot named after the output file name, with any leading slash (/) stripped, contains the last compressed image, appropriately scaled to width and height.


cancel (function)

Inputs
  • string<16> slot

Throws
  • exception ::camera::einval

    • string<128> what

Cancel all jobs publishing to slot.

The effect of this function is that slot will no longer be updated and the associated processing will be cancelled. This is useful to reconfigure the processing graph with e.g. different parameters or different inputs.


status (function)

Inputs
  • string<16> slot

Throws
  • exception ::camera::einval

    • string<128> what

Raise any processing errors associated with slot.

If, for some reason, a slot fails to be updated, the error will be available by checking the result of this function. Processing errors typically include wrong pixel format for a filter or wrong image dimensions.


Tasks

worker

Context

Worker task processing and publishing frames.