Raytrix Light Field SDK  v3.0
Logo
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events Groups Pages
Light Field Computation API functions

Functions to perform computations with ray images. More...

Functions

RXLF_API void Rx::ApiLF::RxAutoDepthPlanes ()
 Do an automatic adaption of the near/far clipping planes. More...
 
RXLF_API void Rx::ApiLF::RxConvertImage (Rx::CRxImage &xDstImage, const Rx::CRxImage &xSrcImage, Rx::Interop::Runtime28::EPixelType::ID eDstPixelType, Rx::Interop::Runtime28::EDataType::ID eDstDataType)
 Convert a Rx::CRxImage to a new pixel and data type. More...
 
RXLF_API void Rx::ApiLF::RxConvertImage (Rx::Interop::Runtime28::IImage *pDstImage, const Rx::Interop::Runtime28::IImage *pSrcImage, Rx::Interop::Runtime28::EPixelType::ID eDstPixelType, Rx::Interop::Runtime28::EDataType::ID eDstDataType, bool bCreate)
 Convert a Rx::CRxImage to a new pixel and data type. More...
 
RXLF_API void Rx::ApiLF::RxDepth3D ()
 Object space depth 3D. More...
 
RXLF_API void Rx::ApiLF::RxDepthColorCode ()
 Colorizes the depth map created by Rx::ApiLF::RxDepthMap.The result is stored in the image with the ID Rx::ApiLF::EImgID::Depth3D. More...
 
RXLF_API void Rx::ApiLF::RxDepthMap ()
 Creates a depth map from the ray depth image created by Rx::ApiLF::RxDepthRay. More...
 
RXLF_API void Rx::ApiLF::RxDepthRay ()
 Estimates the depth of the bound ray image and stores the result in the image with the ID Rx::ApiLF::EImgID::DepthRay. More...
 
RXLF_API void Rx::ApiLF::RxFreeImage (EImgID::ID eImgID)
 Frees memory used by image defined by eImgID. This invalidates the image. More...
 
RXLF_API void Rx::ApiLF::RxGetImage (EImgID::ID eImgID, Rx::CRxImage &xImage)
 Get an internal image. More...
 
RXLF_API void Rx::ApiLF::RxGetImage (EImgID::ID eImgID, Rx::Interop::Runtime28::IImage *pImage, bool bCreate)
 Get an internal image. More...
 
RXLF_API void Rx::ApiLF::RxGetImageDevicePointer (EImgID::ID eImgID, void *&pDevicePtr)
 Get the device pointer of an internal image. More...
 
RXLF_API void Rx::ApiLF::RxGetImageFormat (EImgID::ID eImgID, Rx::CRxImageFormat &xF)
 Get the image format of an internal image. More...
 
RXLF_API void Rx::ApiLF::RxGetImageHistogram (EImgID::ID eImgID, Rx::CRxArrayUInt &xHistogram, unsigned &uChannels)
 Calculates the histogram of the image with the given eImgID and stores the histogram data in the given array. This array must be large enough to hold 4 * 256 numbers. The number of calculated channels is returned in uChannels. More...
 
RXLF_API void Rx::ApiLF::RxGetImageMinMax (EImgID::ID eImgID, unsigned uChannel, float &fMin, float &fMax)
 Finds the minimum and maximum value of the given eImgID. More...
 
RXLF_API void Rx::ApiLF::RxGrid ()
 Show a lens grid overlay on the raw ray image. More...
 
RXLF_API void Rx::ApiLF::RxGridDataImage ()
 Pre Process a ray image with a minimal Set of preprocessing parameter. More...
 
RXLF_API bool Rx::ApiLF::RxIsImageValid (EImgID::ID eImgID)
 Test whether an internal image is valid. More...
 
RXLF_API bool Rx::ApiLF::RxLockCudaMutex (int iTimeout)
 Locks the CUDA Mutex. More...
 
RXLF_API void Rx::ApiLF::RxMapValue (double &dTrg, double dSrc, EValueMapping::ID eValueMapping)
 Map a given source value via the EValueMapping::ID eValueMapping. More...
 
RXLF_API void Rx::ApiLF::RxPreProcess ()
 Pre-Process a ray image. More...
 
RXLF_API void Rx::ApiLF::RxProject (bool &bTargetPointValid, Rx::CRxArrayDouble &aTargetPoint, const Rx::CRxArrayDouble &aSourcePoint, const Rx::Projection::ESpace::ID eTarget, const Rx::Projection::ESpace::ID eSource)
 Projects a point or a set of points in a given source space into a given target space. More...
 
RXLF_API void Rx::ApiLF::RxRefocusBasic ()
 Focus image to a plane perpendicular to the optical axis, i.e. parallel to the image plane. More...
 
RXLF_API void Rx::ApiLF::RxResizeImage (Rx::Interop::Runtime28::IImage *xDstImage, Rx::Interop::Runtime28::IImage *xSrcImage, int iDivider)
 Resize an image. More...
 
RXLF_API void Rx::ApiLF::RxSaveDepth3dMesh (const Rx::CRxString &sxFilename, const double dMaxEdgeLength=-1.0, const double dCropLeftPerc=0.0, const double dCropRightPerc=0.0, const double dCropTopPerc=0.0, const double dCropBottomPerc=0.0)
 Saves the 3D mesh provided by image 'Depth3D' to binary STL format. This requires a valid image computed by Rx::ApiLF::RxDepth3D. Triangles with a depth-variation larger than 'dMaxEdgeLength' for at least one vertex pair are not added to the mesh. More...
 
RXLF_API void Rx::ApiLF::RxSaveDepth3dPointList (const Rx::CRxString &sxFilename)
 Saves the depth values of the current Depth3D image to the given file as a point list. More...
 
RXLF_API void Rx::ApiLF::RxSetImage (EImgID::ID eImgID, const Rx::CRxImage &xImage)
 Set an internal image. More...
 
RXLF_API void Rx::ApiLF::RxSetImage (EImgID::ID eImgID, const Rx::Interop::Runtime28::IImage *pImage)
 Set an internal image. More...
 
RXLF_API void Rx::ApiLF::RxStereo ()
 Creates a stereo image and stores the result in the image with the ID Rx::ApiLF::EImgID::Stereo_ViewCamera. More...
 
RXLF_API void Rx::ApiLF::RxTotalFocus ()
 Focus on a depth surface. More...
 
RXLF_API void Rx::ApiLF::RxUnlockCudaMutex ()
 Unlocks the CUDA Mutex. More...
 

Detailed Description

Functions to perform computations with ray images.

See also
Raytrix Light Field API Computation - Detailed
Programming with the Raytrix Light Field API
Using the Rayrix Light Field API
Raytrix's Projection System - Target View

Function Documentation

RXLF_API void Rx::ApiLF::RxAutoDepthPlanes ( )

Do an automatic adaption of the near/far clipping planes.

Halcon Plugin - Function Name:
rx_auto_depth_planes.
RXLF_API void Rx::ApiLF::RxConvertImage ( Rx::CRxImage xDstImage,
const Rx::CRxImage xSrcImage,
Rx::Interop::Runtime28::EPixelType::ID  eDstPixelType,
Rx::Interop::Runtime28::EDataType::ID  eDstDataType 
)

Convert a Rx::CRxImage to a new pixel and data type.

Parameters
[out]xDstImageDestination image.
xSrcImageReference to the image.
eDstPixelTypePixel type of the converted image.
eDstDataTypeData type of the converted image.
RXLF_API void Rx::ApiLF::RxConvertImage ( Rx::Interop::Runtime28::IImage pDstImage,
const Rx::Interop::Runtime28::IImage pSrcImage,
Rx::Interop::Runtime28::EPixelType::ID  eDstPixelType,
Rx::Interop::Runtime28::EDataType::ID  eDstDataType,
bool  bCreate 
)

Convert a Rx::CRxImage to a new pixel and data type.

Parameters
[out]pDstImageDestination image.
pSrcImageReference to the image.
eDstPixelTypePixel type of the converted image.
eDstDataTypeData type of the converted image.
bCreateif true, memory for the destination image is created by this function.
RXLF_API void Rx::ApiLF::RxDepth3D ( )

Object space depth 3D.

This creates a RGBA float image which maps each pixel in the view camera to a 3D position in object space. The R channel is the X coordinate, the G channel is the Y coordinate and the B channel is the Z coordinate. The Z coordinate is relative to the global coordinate system which typically coincides with the light field camera sensor. All coordinate values are given in millimeters (default) or virtual depth units, depending on the parameter Rx::ApiLF::EPar::Depth3D_UseVirtualDepth .

The image is stored in the image with the ID Rx::ApiLF::EImgID::Depth3D.

Halcon Plugin - Function Name:
rx_depth_3d.
See also
Raytrix's Projection System - Target View
Using the Rayrix Light Field API
Raytrix Light Field API Computation - Detailed
RXLF_API void Rx::ApiLF::RxDepthColorCode ( )

Colorizes the depth map created by Rx::ApiLF::RxDepthMap.The result is stored in the image with the ID Rx::ApiLF::EImgID::Depth3D.

Halcon Plugin - Function Name:
rx_depth_color_code
See also
Raytrix's Projection System - Target View
Using the Rayrix Light Field API
Raytrix Light Field API Computation - Detailed
RXLF_API void Rx::ApiLF::RxFreeImage ( EImgID::ID  eImgID)

Frees memory used by image defined by eImgID. This invalidates the image.

Halcon Plugin - Function Name:
rx_free_image.
Parameters
eImgIDIdentifier for the image.
RXLF_API void Rx::ApiLF::RxGetImage ( EImgID::ID  eImgID,
Rx::CRxImage xImage 
)

Get an internal image.

The available internal image IDs are listed in Rx::ApiLF::EImgID.

Parameters
eImgIDInternal image ID. This is not a ray image handle.
[out]xImageOn return contains a copy of the specified internal image.
RXLF_API void Rx::ApiLF::RxGetImage ( EImgID::ID  eImgID,
Rx::Interop::Runtime28::IImage pImage,
bool  bCreate 
)

Get an internal image.

The available internal image IDs are listed in Rx::ApiLF::EImgID.

Halcon Plugin - Function Name:
rx_get_image.
Parameters
eImgIDInternal image ID. This is not a ray image handle.
[out]pImageOn return contains a copy of the specified internal image.
bCreateIf true, a new image is created in pImage. Otherwise, it is ensured that pImage refers to an image the same size and type as the respective internal image, and then the internal image is copied.
RXLF_API void Rx::ApiLF::RxGetImageDevicePointer ( EImgID::ID  eImgID,
void *&  pDevicePtr 
)

Get the device pointer of an internal image.

Attention
This function returns the image device pointer of an internal image. The available internal image IDs are listed in Rx::ApiLF::EImgID.
Parameters
eImgIDInternal image ID. This is not a ray image handle.
[out]pDevicePtrOn return contains the internal image's device pointer.
RXLF_API void Rx::ApiLF::RxGetImageFormat ( EImgID::ID  eImgID,
Rx::CRxImageFormat xF 
)

Get the image format of an internal image.

Attention
This function returns the image format of an internal image without copying the actual image from the CUDA device to host memory.

The available internal image IDs are listed in Rx::ApiLF::EImgID.

Parameters
eImgIDInternal image ID. This is not a ray image handle.
[out]xFOn return contains the internal image's format.
RXLF_API void Rx::ApiLF::RxGetImageHistogram ( EImgID::ID  eImgID,
Rx::CRxArrayUInt xHistogram,
unsigned &  uChannels 
)

Calculates the histogram of the image with the given eImgID and stores the histogram data in the given array. This array must be large enough to hold 4 * 256 numbers. The number of calculated channels is returned in uChannels.

Parameters
eImgIDThe image ID.
[out]xHistogramA reference of Rx::CRxArrayUInt where the histogram will be stored.
[out]uChannelsThe number of channels.
RXLF_API void Rx::ApiLF::RxGetImageMinMax ( EImgID::ID  eImgID,
unsigned  uChannel,
float &  fMin,
float &  fMax 
)

Finds the minimum and maximum value of the given eImgID.

Parameters
eImgIDThe image ID.
uChannelThe channel.
[out]fMinThe minimum value.
[out]fMaxThe maximum value.
RXLF_API void Rx::ApiLF::RxGrid ( )

Show a lens grid overlay on the raw ray image.

The result is written to the internal image with ID Rx::ApiLF::EImgID::Grid .

RXLF_API void Rx::ApiLF::RxGridDataImage ( )

Pre Process a ray image with a minimal Set of preprocessing parameter.

This function does the same preprocessing as Rx::ApiLF::RxPreProcess but all preprocessing flags with exception of Debayering are deactivated.

The following parameters of Rx::ApiLF::EPar::ID affect the RxGridDataImage computation:

RXLF_API bool Rx::ApiLF::RxIsImageValid ( EImgID::ID  eImgID)

Test whether an internal image is valid.

Attention
The available internal image IDs are listed in Rx::ApiLF::EImgID.
Halcon Plugin - Function Name:
rx_is_image_valid.
Parameters
eImgIDInternal image ID. This is not a ray image handle.
Returns
true if the image is valid, false otherwise.
RXLF_API bool Rx::ApiLF::RxLockCudaMutex ( int  iTimeout)

Locks the CUDA Mutex.

Parameters
iTimeoutIf the mutex is locked, the timeout defines the time in ms until a Rx::ApiLF::CRxApiException is thrown.
Returns
True if it succeeds, false if it fails.
RXLF_API void Rx::ApiLF::RxMapValue ( double &  dTrg,
double  dSrc,
EValueMapping::ID  eValueMapping 
)

Map a given source value via the EValueMapping::ID eValueMapping.

Halcon Plugin - Function Name:
rx_map_value.
Parameters
[out]dTrgTarget value.
dSrcSource value.
eValueMappingThe value mapping.
RXLF_API void Rx::ApiLF::RxPreProcess ( )

Pre-Process a ray image.

The ray image that is bound with Rx::ApiLF::RxRayBind is a raw light field image. Before this ray image can be used by the actual processing algorithms, it has to be adjusted by applying a rectification of a possible radial distortion and by adjusting its brightness and color with respect to a white image.

The parameters of the preprocessing step are read/set with Rx::ApiLF::RxGetPar / Rx::ApiLF::RxSetPar via the parameters IDs Rx::ApiLF::EPar. When these parameters are changed the ray field image on the device is not automatically adjusted accordingly. Changed preprocess parameters are only applied when the function RxPreProcess is called.

The following parameters of Rx::ApiLF::EPar::ID affect the preprocess computation:

Halcon Plugin - Function Name:
rx_pre_process
See also
Programming with the Raytrix Light Field API
Raytrix Light Field API Computation - Detailed
RXLF_API void Rx::ApiLF::RxProject ( bool &  bTargetPointValid,
Rx::CRxArrayDouble aTargetPoint,
const Rx::CRxArrayDouble aSourcePoint,
const Rx::Projection::ESpace::ID  eTarget,
const Rx::Projection::ESpace::ID  eSource 
)

Projects a point or a set of points in a given source space into a given target space.

Attention
Parameters
[out]bTargetPointValidTarget point valid.
[out]aTargetPointTarget point.
aSourcePointSource point.
eTargetThe target space.
eSourcethe source space.
See also
Raytrix's Projection System - Target View.
RXLF_API void Rx::ApiLF::RxRefocusBasic ( )

Focus image to a plane perpendicular to the optical axis, i.e. parallel to the image plane.

This focuses to a plane perpendicular to the optical axis. To change the focal plane, use parameter Rx::ApiLF::EPar::Focus_RelativeFocusPlane. A relative focus value of zero refocuses to the plane furthest away from the viewer and a value of 1 would focus to a plane that passes through the object side focal point of the recording lens.

The result is written to the internal image with ID Rx::ApiLF::EImgID::RefocusBasic_VirtualSpace, Rx::ApiLF::EImgID::RefocusBasic_ObjectSpace, Rx::ApiLF::EImgID::RefocusBasic_ViewCamera depending on the current Rx::ApiLF::EPar::Proj_CurrentTargetView . The size of this resultant image is set in relation to the ray image size via the parameter Rx::ApiLF::EPar::Focus_ResImgDiv .

The following Parameter affect the computation of Rx::ApiLF::RxRefocusBasic:

Halcon Plugin - Function Name:
rx_refocus_basic
See also
Using the Rayrix Light Field API
Raytrix Light Field API Computation - Detailed
RXLF_API void Rx::ApiLF::RxResizeImage ( Rx::Interop::Runtime28::IImage xDstImage,
Rx::Interop::Runtime28::IImage xSrcImage,
int  iDivider 
)

Resize an image.

Parameters
[out]xDstImageThe target image to store the result.
[in]xSrcImageThe image that is to be resized.
[in]iDividerThe image size divider. For example, if iDivder = 2, then the resultant image size is half the original size.
RXLF_API void Rx::ApiLF::RxSaveDepth3dMesh ( const Rx::CRxString sxFilename,
const double  dMaxEdgeLength = -1.0,
const double  dCropLeftPerc = 0.0,
const double  dCropRightPerc = 0.0,
const double  dCropTopPerc = 0.0,
const double  dCropBottomPerc = 0.0 
)

Saves the 3D mesh provided by image 'Depth3D' to binary STL format. This requires a valid image computed by Rx::ApiLF::RxDepth3D. Triangles with a depth-variation larger than 'dMaxEdgeLength' for at least one vertex pair are not added to the mesh.

Parameters
sxFilenameThe filename.
dMaxEdgeLength(Optional) Limit for depth-variation in vertices. -1 = infinity.
dCropLeftPerc(Optional) the percentage of the cropping on the left side.
dCropRightPerc(Optional) the percentage of the cropping on the right side.
dCropTopPerc(Optional) the percentage of the cropping on the top side.
dCropBottomPerc(Optional) the percentage of the cropping on the bottom side.
RXLF_API void Rx::ApiLF::RxSaveDepth3dPointList ( const Rx::CRxString sxFilename)

Saves the depth values of the current Depth3D image to the given file as a point list.

The formats available are:

ASCII:

  • .txt – one point per row as plain text (default when no other extension matches, .txt is appended to filename)
  • .xyz – conform to the 'xyz' file standard (augments txt format with small header)

Binary:

Parameters
sxFilenameThe filename.
RXLF_API void Rx::ApiLF::RxSetImage ( EImgID::ID  eImgID,
const Rx::CRxImage xImage 
)

Set an internal image.

The available internal image IDs are listed in Rx::ApiLF::EImgID.

A new ray image can be set with eImgID set to Rx::ApiLF::EImgID::Raw and a new white image with Rx::ApiLF::EImgID::White. RxSetImage copies the image data into the currently bound ray image and to the CUDA device. For the new ray image to be used in calculations you must call Rx::ApiLF::RxPreProcess after setting the ray and the white image.

You can also circumvent the internal preprocessing of the ray image by writing directly the processed ray image to the CUDA device with Rx::ApiLF::EImgID::Processed_Normalized. However, this will not change the Rx::ApiLF::EImgID::Raw or Rx::ApiLF::EImgID::White images currently bound.

Parameters
eImgIDInternal image ID. This is not a ray image handle.
xImageThe image to copy into the specified internal image.
RXLF_API void Rx::ApiLF::RxSetImage ( EImgID::ID  eImgID,
const Rx::Interop::Runtime28::IImage pImage 
)

Set an internal image.

The available internal image IDs are listed in Rx::ApiLF::EImgID.

A new ray image can be set with eImgID set to Rx::ApiLF::EImgID::Raw and a new white image with Rx::ApiLF::EImgID::White. RxSetImage copies the image data into the currently bound ray image and to the CUDA device. For the new ray image to be used in calculations you must call Rx::ApiLF::RxPreProcess after setting the ray and the white image.

You can also circumvent the internal preprocessing of the ray image by writing directly the processed ray image to the CUDA device with Rx::ApiLF::EImgID::Processed_Normalized. However, this will not change the Rx::ApiLF::EImgID::Raw or Rx::ApiLF::EImgID::White images currently bound.

Parameters
eImgIDInternal image ID. This is not a ray image handle.
pImageThe image to copy into the specified internal image.
RXLF_API void Rx::ApiLF::RxStereo ( )
RXLF_API void Rx::ApiLF::RxTotalFocus ( )

Focus on a depth surface.

In principle, each pixel of the result image can be focused individually. The function Rx::ApiLF::RxTotalFocus makes this property available by focusing the ray image to the depth surface given in the internal depth image related to the target space that is selected (Set Rx::ApiLF::EPar::Proj_CurrentTargetView to one of the spaces in Rx::Projection::ESpace::ID). To calculate the depth image you have to call Rx::ApiLF::RxDepthRay first and next Rx::ApiLF::RxDepthMap, or by a user defined image set with Rx::ApiLF::RxSetImage.

When setting a depth image with Rx::ApiLF::RxSetImage it need not have the same dimensions as the resultant image. The given depth map is implicitly scaled to the size of the resultant refocused image.

If the size of the given depth map image is 1x1 pixel, the depth encoded for that pixel is applied to all focused pixel. The depth image has to be of pixel type Rx::Interop::Runtime28::EPixelType::Lum and data type Rx::Interop::Runtime28::EDataType::UByte. The pixel value range of [0,255] is mapped to [0,1] for the interpretation as depth.

Attention
The result is written to the internal image related to the Rx::ApiLF::EPar::Proj_CurrentTargetView that is selected (e.g. Rx::ApiLF::EImgID::TotalFocus_VirtualSpace, Rx::ApiLF::EImgID::TotalFocus_ObjectSpace, Rx::ApiLF::EImgID::TotalFocus_ViewCamera). The size of this resultant image is set in relation to the ray image size via the parameter Rx::ApiLF::EPar::Focus_ResImgDiv.

The following Parameter affect the computation of Rx::ApiLF:RxTotalFocus:

Halcon Plugin - Function Name:
rx_total_focus
See also
Raytrix's Projection System - Target View
Using the Rayrix Light Field API
Raytrix Light Field API Computation - Detailed
RXLF_API void Rx::ApiLF::RxUnlockCudaMutex ( )

Unlocks the CUDA Mutex.