Raytrix Light Field SDK  4.0
Logo
Programming with the Raytrix Light Field API

Contents


Standard Raytrix image processing

The fundamental concept behind the Raytrix Light Field API is shown in the following diagram.

ImageProcessingProcedur01_medium.png
Standard ray image processing

The workflow can be divided into three basic steps:

  1. Bind an image source to the Raytrix Light Field API
  2. Process the image data on CUDA device
  3. Get the processed image

After an image has been copied from the CUDA device it can be processed in a custom program or it can be displayed on screen.

There are three different image sources for the Raytrix Light Field API:

Raytrix Image Source (*.ray)

Load an Image

The Raytrix Light Field API allows you to load a various number of images.

To load an image (.ray) from the filesystem use Rx::ApiLF::RxRayLoad

This function does not return the ray image itself, but a handle to the ray image.

Attention
Before any calculations can be performed with the ray image, it has to be copied to the CUDA device, since all operations are performed by CUDA. Copying the ray image to the CUDA device is done by the function Rx::ApiLF::RxRayBind(). After this function is called, all ray image processing operations act on the bound ray image, without the need for repeated copying operations of the ray image to the CUDA device.

A valid ray image handle can be used in:

See also
Bind Image

Bind Image

All the image processing of the Raytrix Light Field API requires a bound image.

To bind an image to the Raytrix Light Field API call Rx::ApiLF::RxRayBind

All the operations are performed on the graphical card which has to be a CUDA device.

Before the actual image processing can be started the bound image has to be preprocessed:

After the image has been processed it can be copied back to the host device which allows you to process them with a custom program, by just using:

They are then available for further processing by an image processing library of your choice.

See also
Load an Image
Unbind an Image

Unbind an Image

If a ray image is unbound it is not deleted internally. That is, it can be bound again, or saved.

Attention
Make sure to delete ray images that are no longer needed with Rx::ApiLF::RxRayDelete. Otherwise the memory may fill up rather quickly. If you call Rx::ApiLF::RxFinalize all ray images in memory are deleted, all cameras are closed and any memory allocated on the CUDA device is freed. However, you cannot call any API functions except for Rx::ApiLF::RxInit after a call of Rx::ApiLF::RxFinalize.
See also
Load an Image
Bind Image

Raytrix Image Sequence Source (*.rays)

Open Image Sequences

You have the possibility to load sequences in read or in write mode by calling Rx::ApiLF::RxRaySeqOpen

This function returns a handle to the ray sequence.

A valid ray image sequence handle can be used in:

Attention
You can bind one sequence in read and one sequence in write mode simultaneously
See also
Bind an Image Sequence
Close Image Sequences

Bind an Image Sequence

To bind an image sequence call Rx::ApiLF::RxRaySeqBind

Only one ray sequence for reading and one ray sequence for writing can be bound at a time. When a ray sequence is bound for reading, any currently bound ray image is unbound, a new prototype ray image of the format of the ray sequence is created and bound and the first image of the ray sequence is loaded into the bound ray image.The ID of the newly created ray image is returned.No new ray image can be bound until the ray sequence is unbound using RaySeqUnbind().If a camera capture is started while a ray sequence is bound for reading, the ray sequence is automatically unbound. While a camera is in capture mode, no ray sequence can be bound for reading.

When a ray sequence is bound for writing a ray image must already be bound. If the ray sequence is empty up to now, the ray sequence is created for the currently bound image type and only ray images of the same format can be written to the ray sequence.Also only ray images of the same format can be bound while the ray sequence is bound. If the ray sequence already contains images, it can only be bound if the currently bound ray image format is of the same format as the ray sequence. If a ray sequence in write mode is bound and camera capture is started the ray sequence is also unbound if the image formats do not agree.To capture frames from a camera, first start the camera capture, then bind the ray sequence in write mode and set the parameter Rx::ApiLF::EPar::RaySeq_AutoStoreCamFrames to 1. The value returned is the ray image ID of the currently bound ray image.

See also
Open Image Sequences
Unbind an image Sequence

Unbind an image Sequence

Unbind a ray sequence with Rx::ApiLF::RxRaySeqUnbind
Attention
If a ray sequence in write mode is unbound, the currently bound ray image stays bound. No more images can be written to the ray sequence once it has been unbound, however, the ray sequence has not been closed. It can be bound again to write further ray images to it. If a ray sequence in read mode is unbound, the currently bound ray image stays bound. The ray image is therefore also not removed from memory. You have to unbind the ray image and then delete it to free all memory.
See also
Open Image Sequences
Bind an Image Sequence
Close Image Sequences

Close Image Sequences

Close a ray sequence by calling Rx::ApiLF::RxRaySeqClose.

Warning
Closing a ray sequence also unbinds the corresponding ray sequence. The ray sequence ID becomes invalid once the ray sequence has been closed.
See also
Open Image Sequences

Camera Source

Prepare a Camera

Before you can capture images from a Raytrix camera you have to do the following preparations:

The first function uses the path given in Rx::ApiLF::RxInit to search for the camera driver DLLs (RaytrixCamera_*.dll), then to load and to initialize them.

Attention
This function has to be called before any other Raytrix API camera function.

This functions registers all cameras that are currently available. Only registered cameras can be used by the Raytrix API. This function can be called repeatedly to update the list of available cameras.

Attention
This function has to be called after Rx::ApiLF::RxCamDriverInit and before any other API camera functions.

After you have prepared your camera(s) you can proceed with the opening:

See also
Open a Camera

Open a Camera

Open a camera with Rx::ApiLF::RxCamOpen.

When you open a camera you receive the handle of this camera. More than one camera can be opened. They are addressed by their camera handle.

A valid camera handle can be used in:

Attention
You can bind exactly one camera to the Raytrix Light Field API by its handle.
See also
Prepare a Camera
Bind a Camera
Close a Camera

Bind a Camera

Bind a camera with Rx::ApiLF::RxCamBind.

When you bind a camera you receive the image handle that refers to the bound image in the Raytrix Light Field API.

Before you can bind a camera you have to preprocess all camera sources (Prepare a Camera), subsequently you have to open the camera (Open a Camera).

After a camera is bound to the Raytrix Light Field API you can start capturing images.

See also
Open a Camera
Unbind a Camera
Start the capture process of a Camera

Unbind a Camera

Unbind a camera with Rx::ApiLF::RxCamUnbind.

Unbinds a currently bound camera. If the bound camera is still capturing images, the capturing is stopped and then the camera is unbound.

See also
Open a Camera
Bind a Camera
Close a Camera

Close a Camera

Close a camera with Rx::ApiLF::RxCamClose.

If the given camera is currently bound, the camera is un-bound before closing. Also, if the camera is in capture mode, the capturing is stopped before un-binding.

See also
Open a Camera

Start the capture process of a Camera

Start the capture process with Rx::ApiLF::RxCamStartCapture.

You can set the capturing mode by the parameter

Rx::ApiLF::Cam_TriggerMode to one of the modes in Rx::Interop::Runtime30::Camera::ETriggerMode.

When all of this was successful, images can be captured with Rx::ApiLF::RxCamRetrieveImage.

See also
Retrieve Images from a Raytrix Camera