DAVID4 SDK  1.8.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
DAVID Low Level Library (d4lib)

Provides a low level C interface to 'Scanning' and 'Shape Fusion' functions. More...

Classes

struct  d4img_ImageFormat
 Describes the format of an image. More...
 
struct  d4calib_CalibPoint
 Point correspondence used for calibration. More...
 
struct  d4sls_CodedLightPhaseShiftParams
 Defines parameters used in structured light mode 'coded light + phase shift' ('cl+ps'). More...
 
struct  d4sls_Plane
 Defines a plane in 3D. Used for d4sls_planesToDepthImage. More...
 
struct  d4mesh_SubmeshVertexIndex
 Index to define a vertex in a submesh. More...
 
struct  d4mesh_MotionInfo
 Provides user knowledge about the motion between two scans. More...
 
struct  d4mesh_PosesWithTolerances
 A list of poses (4*4 matrices) plus tolerances for translation and rotation. More...
 
struct  d4mesh_CoarseAlignParams
 Parameter set for Coarse Alignment, see d4mesh_alignPairCoarse. More...
 
struct  d4mesh_FineAlignParams
 Parameter set for Fine Alignment, see d4mesh_alignPairFine. More...
 
struct  d4mesh_GlobalFineAlignParams
 Parameter set for Global Fine Alignment, see d4mesh_alignGlobalFine. More...
 

Library initialization and basic types

Note
The DAVID Low Level Library has to be initialized once. Licensing is usually done by license files / USB key. The License key parameter is only required for special/future versions. Normally, please use nullptr.
int result = d4lib_init(nullptr);

When you are done, call d4lib_release.

enum  d4error_ErrorCode {
  d4ok = 0, d4error_InvalidArgument = -100, d4error_FormatNotAvailable = -101, d4error_InvalidFormat = -102,
  d4error_NoAccess = -103, d4error_MissingObject = -104, d4error_OutOfMemory = -105, d4error_Abort = -106,
  d4error_Fail = -107, d4error_NotLicensed = -108, d4error_NotImplemented = -109, d4error_InvalidPath = -200,
  d4error_FileNotFound = -201, d4error_DirectoryNotFound = -202, d4error_MissingFilename = -203, d4error_InconsistentBuffer = -204,
  d4error_InvalidVersion = -205, d4error_DeviceNotAvailable = -300, d4error_NoLiveImage = -301, d4error_ActuatorStalled = -302,
  d4error_CameraCalibration = -400, d4error_ProjectorCalibration = -401, d4error_ScanFailed = -500, d4error_NotCalibrated = -501,
  d4error_AlignFailed = -600, d4error_InvalidMeshId = -601
}
 All DAVID Low Level Library functions return an error code. More...
 
typedef size_t d4size
 Basic size type.
 
typedef struct d4img * d4img_ptr
 Image pointer.
 
typedef struct d4fimg * d4fimg_ptr
 Float image pointer.
 
typedef struct d4cam * d4cam_ptr
 Camera pointer.
 
typedef struct d4projector * d4projector_ptr
 Projector pointer.
 
typedef struct d4calib * d4calib_ptr
 Calibration pointer.
 
typedef struct d4sls * d4sls_ptr
 Structured light scanning pointer.
 
typedef struct d4mesh * d4mesh_ptr
 Mesh pointer.
 
D4LIB_API int d4lib_init (const char *licenseKey)
 Initialize DAVID Low Level Library. More...
 
D4LIB_API int d4lib_release ()
 Release DAVID Low Level Library. More...
 
D4LIB_API int d4lib_getVersion (char *version, d4size maxLength)
 Get version of library. More...
 

Memory management

Objects are created and deleted by the library.

In order to create new objects use the d4xxx_newXxx functions. Life time of an object is managed by reference counting: Use d4mem_decRefCount to release an object.

D4LIB_API int d4mem_decRefCount (void *ptr)
 Decrement the reference count for the object identified by 'ptr'. More...
 
D4LIB_API int d4mem_incRefCount (void *ptr)
 Increment the reference count for the object identified by 'ptr'. More...
 

Images

Functions and types related to images.

Notes:

enum  d4img_PixelFormat {
  d4img_UnknownPixelFormat = 0, d4img_Y800, d4img_RGB24, d4img_YUY2,
  d4img_BY8
}
 Supported pixel formats. More...
 
D4LIB_API d4img_ptr d4img_newImage ()
 Creates a new image. More...
 
D4LIB_API int d4img_getImageFormat (d4img_ptr img, int *width, int *height, int *pixelFormat)
 Get format of the image. More...
 
D4LIB_API int d4img_setImageFormat (d4img_ptr img, int width, int height, int pixelFormat)
 Set format of the image. More...
 
D4LIB_API int d4img_getImageData (d4img_ptr img, void *data, d4size size, int pixelFormat)
 Get image data. More...
 
D4LIB_API int d4img_setImageData (d4img_ptr img, const void *data, d4size size, int pixelFormat)
 Set the image data. More...
 
D4LIB_API int d4img_convert (d4img_ptr destImg, int pixelFormat, d4img_ptr srcImg)
 Set the image data. More...
 
D4LIB_API int d4img_import (d4img_ptr img, const char *filename)
 Import image from file. More...
 
D4LIB_API int d4img_export (d4img_ptr img, const char *filename)
 Export image to file. More...
 
D4LIB_API int d4img_computeColorImage (d4img_ptr outputColorImage, d4img_ptr *inputGrayImages, int inputImageCount)
 Compute a color image from 3 or 4 grayscale images that were capture under specific lighting conditions. More...
 
D4LIB_API int d4img_computeWhiteBalance (d4img_ptr img, double *redFactor, double *greenFactor, double *blueFactor)
 Compute white balance parameters. More...
 
D4LIB_API int d4img_applyWhiteBalance (d4img_ptr img, double redFactor, double greenFactor, double blueFactor)
 Apply white balance correction to 'img'. More...
 

Float images

Special functions and types related to scalar float images.

Each pixel has a 32bit scalar float value with no special bounds on ranges. Notes:

enum  d4fimg_ReplaceOp { d4fimg_ReplaceIfLess, d4fimg_ReplaceIfGreater }
 Supported replace operations. More...
 
D4LIB_API d4fimg_ptr d4fimg_newImage ()
 Creates a new 32bit float image. More...
 
D4LIB_API int d4fimg_getImageFormat (d4fimg_ptr img, int *width, int *height)
 Get format of the float image. More...
 
D4LIB_API int d4fimg_setImageFormat (d4fimg_ptr img, int width, int height)
 Set format of the float image. More...
 
D4LIB_API int d4fimg_getImageData (d4fimg_ptr img, float *data, d4size size)
 Get image data. More...
 
D4LIB_API int d4fimg_setImageData (d4fimg_ptr img, const float *data, d4size size)
 Set image data. More...
 
D4LIB_API int d4fimg_replace (d4fimg_ptr img, float replaceValue, d4fimg_ptr compare, float threshold, int replaceOp)
 Replace pixel value by 'replaceValue', if condition is valid. More...
 
D4LIB_API int d4fimg_setFloat (d4fimg_ptr img, float value)
 Sets all pixel values to given float value. More...
 
D4LIB_API int d4fimg_export (d4fimg_ptr img, const char *filename)
 Export float image to file. More...
 
D4LIB_API int d4fimg_import (d4fimg_ptr img, const char *filename)
 Import float image from file. More...
 

Camera

Functions and types related to camera interface.

Note
At the moment, only DirectShow cameras are supported.
D4LIB_API d4cam_ptr d4cam_newDirectShowCamera ()
 Creates a new DirectShow camera instance. More...
 
D4LIB_API int d4cam_getAvailableCamerasCount (d4cam_ptr cam, int *count)
 Get the number of available cameras. More...
 
D4LIB_API int d4cam_getAvailableCamerasName (d4cam_ptr cam, char *name, d4size maxLength, int index)
 Get the name of an available camera. More...
 
D4LIB_API int d4cam_open (d4cam_ptr cam, const char *name, int width, int height, int pixelFormat, double fps)
 Open camera. More...
 
D4LIB_API int d4cam_check (d4cam_ptr cam)
 Check if camera is open and ok. More...
 
D4LIB_API int d4cam_close (d4cam_ptr cam)
 Close camera. More...
 
D4LIB_API int d4cam_pause (d4cam_ptr cam)
 Set running camera into a paused state. More...
 
D4LIB_API int d4cam_captureImageAsync (d4cam_ptr cam, int minContentChange, double maxWaitTime, int temporalSmoothCount)
 Start a new asynchronous image capture. More...
 
D4LIB_API int d4cam_setSkipCount (d4cam_ptr cam, int skipCount)
 Set the number of images that are skipped after a content change was detected. More...
 
D4LIB_API int d4cam_getCapturedImage (d4cam_ptr cam, d4img_ptr img, int pixelFormat)
 Get the captured image. More...
 
D4LIB_API int d4cam_getImageFormat (d4cam_ptr cam, int *width, int *height, int *pixelFormat, double *fps)
 Get the image format of the camera. More...
 
D4LIB_API int d4cam_getTimestamp (d4cam_ptr cam, double *timestamp)
 Get the timestamp of the last captured image. More...
 
D4LIB_API int d4cam_setProperty (d4cam_ptr cam, double value, const char *name)
 Set a camera property. More...
 
D4LIB_API int d4cam_getProperty (d4cam_ptr cam, double *value, const char *name)
 Get a camera property. More...
 
D4LIB_API int d4cam_getPropertyRange (d4cam_ptr cam, double *minValue, double *maxValue, double *defValue, double *deltaValue, const char *name)
 Get a camera property range. More...
 
D4LIB_API int d4cam_getPropertyCount (d4cam_ptr cam, int *count, bool onlyAvailable)
 Get number of all camera property names or 'onlyAvailable' camera property names. More...
 
D4LIB_API int d4cam_getPropertyName (d4cam_ptr cam, char *name, d4size maxLength, int propertyNameIndex, bool onlyAvailable)
 Get a camera property name. More...
 

Projector

Interface functions for controlling projectors.

Notes:

D4LIB_API d4projector_ptr d4projector_newExtendedDisplayProjector ()
 Creates a new projector using extended display. More...
 
D4LIB_API int d4projector_close (d4projector_ptr projector)
 Closes the connection to the projector. More...
 
D4LIB_API int d4projector_getImageFormat (d4projector_ptr projector, int *width, int *height, int *pixelFormat)
 Get image format for displaying images. More...
 
D4LIB_API int d4projector_displayImage (d4projector_ptr projector, d4img_ptr img)
 Display an image. More...
 
D4LIB_API int d4projector_displayUniformColor (d4projector_ptr projector, unsigned char red, unsigned char green, unsigned char blue)
 Display an image with a uniform color. More...
 
D4LIB_API int d4projector_openByScreenID (d4projector_ptr projector, int screenID)
 Establish the connection to a projector by given 'screenID'. More...
 
D4LIB_API int d4projector_check (d4projector_ptr projector)
 Check if projector is open and ok. More...
 
D4LIB_API int d4projector_getScreenCount (d4projector_ptr projector, int *screenCount)
 Get the number of available screens. More...
 
D4LIB_API int d4projector_getScreenFormat (d4projector_ptr projector, int *x, int *y, int *width, int *height, int screenID)
 Get screen dimensions and position for requested screen. More...
 

Calibration

Interface functions related to camera and projector calibration.

Notes:

enum  d4calib_CamCalibError {
  d4calib_CamCalibError_ok = 0, d4calib_CamCalibError_MarkerDetection = -100, d4calib_CamCalibError_MarkerMapping = -101, d4calib_CamCalibError_PlaneIntersection = -102,
  d4calib_CamCalibError_LeftPlane = -103, d4calib_CamCalibError_RightPlane = -104, d4calib_CamCalibError_ModelFitting = -105, d4calib_CamCalibError_ErrorValuesTooHigh = -106,
  d4calib_CamCalibError_Unknown = -107
}
 More detailed camera calibration error. More...
 
enum  d4calib_ProjectorCalibError { d4calib_ProjectorCalibError_ok = 0, d4calib_ProjectorCalibError_PhaseImage = -200, d4calib_ProjectorCalibError_ModelFitting = -201, d4calib_ProjectorCalibError_Unknown = -202 }
 More detailed projector calibration error. More...
 
D4LIB_API d4calib_ptr d4calib_newCameraCalibration ()
 Create a new calibration object for cameras. More...
 
D4LIB_API d4calib_ptr d4calib_newProjectorCalibration ()
 Create a new calibration object for projectors. More...
 
D4LIB_API int d4calib_isCalibrated (d4calib_ptr calib, bool *calibrated)
 Is calibration valid? More...
 
D4LIB_API int d4calib_importCalibration (d4calib_ptr calib, const char *filename)
 Import calibration data from file. More...
 
D4LIB_API int d4calib_exportCalibration (d4calib_ptr calib, const char *filename)
 Export calibration data to file. More...
 
D4LIB_API int d4calib_changeCalibrationResolution (d4calib_ptr calib, int newWidth, int newHeight)
 Change resolution of image format used for calibration. More...
 
D4LIB_API int d4calib_getCalibrationResolution (d4calib_ptr calib, int *width, int *height)
 Get the resolution of a calibration. More...
 
D4LIB_API int d4calib_calibrate (d4calib_ptr camCalib, d4img_ptr imgCamCalib, d4calib_ptr projectorCalib, d4sls_ptr sls, d4img_ptr *capturedImages, int imageCount, double scale, bool compensatePatternOffsets, int *calibError, d4calib_CalibPoint *calibPoints, int *calibPointCount)
 Standard calibration procedure for one camera and one projector using the corner calibration panels. More...
 

Structured Light Scanner

Types and functions related to Structured Light Scanning (SLS).

Notes:

enum  d4sls_ColorSelect { d4sls_White, d4sls_Red, d4sls_Green, d4sls_Blue }
 Selects the color used for all generated patterns. More...
 
enum  d4sls_Orientation { d4sls_HorizontalOrientation, d4sls_VerticalOrientation, d4sls_BothOrientations }
 Defines orientations for hardware setup. More...
 
D4LIB_API d4sls_ptr d4sls_newStructuredLightScanner ()
 Create new SLS object. More...
 
D4LIB_API int d4sls_getCodedLightPhaseShiftParams (d4sls_ptr sls, d4sls_CodedLightPhaseShiftParams *params)
 Get parameters for 'cl+ps' mode. More...
 
D4LIB_API int d4sls_setCodedLightPhaseShiftParams (d4sls_ptr sls, const d4sls_CodedLightPhaseShiftParams *params)
 Set parameters for 'cl+ps' mode. More...
 
D4LIB_API int d4sls_getPatternCount (d4sls_ptr sls, int *patternCount)
 Get number of pattern in a scanning sequence. More...
 
D4LIB_API int d4sls_getPatternImage (d4sls_ptr sls, d4img_ptr img, int width, int height, int pixelFormat, int patternIndex)
 Get pattern image at 'patternIndex'. More...
 
D4LIB_API int d4sls_getSetupImage (d4sls_ptr sls, d4img_ptr img, int width, int height, int pixelFormat)
 Get special image for setup. More...
 
D4LIB_API int d4sls_getChessboardImage (d4sls_ptr sls, d4img_ptr img, int width, int height, int pixelFormat, d4calib_ptr projectorCalib, double scale)
 Get special chessboard image that can be used to validate a calibration performed by d4calib_calibrate. More...
 
D4LIB_API int d4sls_computeDepthImage (d4sls_ptr sls, d4fimg_ptr depthImage, d4fimg_ptr qualityImage, d4img_ptr *capturedImages, int imageCount, d4calib_ptr camCalib, d4calib_ptr projectorCalib, int minContrast)
 Compute depth image that represents the current scan. More...
 
D4LIB_API int d4sls_planesToDepthImage (d4sls_ptr sls, d4fimg_ptr depthImage, d4calib_ptr camCalib, int numPlanes, const d4sls_Plane *planes)
 Computes a depth image from a list of planes. More...
 

Scanning

Generic scanning functions.

Notes:

D4LIB_API int d4scan_convertDepthImageToMesh (d4mesh_ptr mesh, d4fimg_ptr depthImage, d4fimg_ptr qualityImage, d4calib_ptr calib, float minDepth, float maxDepth, float depthThres, float minQuality, double outlierRemoval)
 Compute mesh from a depth image. More...
 
D4LIB_API int d4scan_removeBackground (d4fimg_ptr depthImage, d4fimg_ptr backgroundImage, float epsilon)
 Remove background scan from current scan. More...
 

Mesh

A triangulated mesh represents the surface of a 3D object.

More information about triangulated meshes:

Notes:

enum  d4mesh_BufferType {
  d4mesh_VertexPositionBuffer, d4mesh_VertexNormalBuffer, d4mesh_VertexTexCoordBuffer, d4mesh_VertexColorBuffer,
  d4mesh_TriangleIndexBuffer, d4mesh_VertexQualityBuffer
}
 Buffer selection. More...
 
D4LIB_API d4mesh_ptr d4mesh_newMesh ()
 Create new mesh object. More...
 
D4LIB_API int d4mesh_clear (d4mesh_ptr mesh)
 Clear all data of mesh object. More...
 
D4LIB_API int d4mesh_copy (d4mesh_ptr targetMesh, d4mesh_ptr sourceMesh)
 Copy mesh data from 'sourceMesh' to 'targetMesh'. More...
 
D4LIB_API int d4mesh_combine (d4mesh_ptr meshGroup, d4mesh_ptr *meshesToCombine, int meshCount)
 Combine multiple meshes into submeshes of a single mesh. More...
 
D4LIB_API int d4mesh_uncombine (d4mesh_ptr meshGroup, d4mesh_ptr *uncombinedMeshes, int meshCount)
 Uncombine submeshes of 'meshGroup' into independent meshes. More...
 
D4LIB_API int d4mesh_getSubmeshCount (d4mesh_ptr mesh, int *count)
 Get the number of submeshes (combined meshes) in 'mesh'. More...
 
D4LIB_API int d4mesh_setSubmeshCount (d4mesh_ptr mesh, int count)
 Set the number of submeshes (combined meshes) in 'mesh'. More...
 
D4LIB_API int d4mesh_getBuffer (d4mesh_ptr mesh, void *data, d4size size, int bufferType, int submeshIndex)
 Copy requested buffer ('bufferType') content into 'data'. More...
 
D4LIB_API int d4mesh_setBuffer (d4mesh_ptr mesh, const void *data, d4size size, int bufferType, int submeshIndex)
 Copy 'data' into the desired buffer ('bufferType'). More...
 
D4LIB_API int d4mesh_hasBuffer (d4mesh_ptr mesh, bool *hasBuffer, int bufferType, int submeshIndex)
 Is the buffer 'bufferType' available? See d4mesh_BufferType for information about which buffers are optional. More...
 
D4LIB_API int d4mesh_getBufferSize (d4mesh_ptr mesh, d4size *size, int bufferType, int submeshIndex)
 Get size of buffer 'bufferType' in bytes (for all submeshes). More...
 
D4LIB_API int d4mesh_getVertexCount (d4mesh_ptr mesh, int *vertexCount, int submeshIndex)
 Get the number of vertices for a given submesh of a mesh. More...
 
D4LIB_API int d4mesh_setVertexCount (d4mesh_ptr mesh, int vertexCount, int submeshIndex)
 Set the number of vertices for a given submesh of a mesh. More...
 
D4LIB_API int d4mesh_getTriangleCount (d4mesh_ptr mesh, int *triangleCount, int submeshIndex)
 Get the number of triangles (total count for all submeshes). More...
 
D4LIB_API int d4mesh_setTriangleCount (d4mesh_ptr mesh, int triangleCount, int submeshIndex)
 Set the number of triangles for a given submesh of a mesh. More...
 
D4LIB_API int d4mesh_getName (d4mesh_ptr mesh, char *name, d4size maxLength)
 Get the name of a mesh. More...
 
D4LIB_API int d4mesh_setName (d4mesh_ptr mesh, const char *name)
 Set the name of a mesh. More...
 
D4LIB_API d4img_ptr d4mesh_getTexture (d4mesh_ptr mesh, int submeshIndex)
 Get the texture of a mesh. More...
 
D4LIB_API int d4mesh_setTexture (d4mesh_ptr mesh, d4img_ptr image, int submeshIndex)
 Set the texture of a mesh. More...
 
D4LIB_API int d4mesh_hasTexture (d4mesh_ptr mesh, bool *hasTexture, int submeshIndex)
 Has 'mesh' a texture? More...
 
D4LIB_API int d4mesh_getPose (d4mesh_ptr mesh, double world_T_local[16])
 Get the position and orientation (pose) of a mesh. More...
 
D4LIB_API int d4mesh_setPose (d4mesh_ptr mesh, const double world_T_local[16])
 Set the position and orientation (pose) of a mesh. More...
 

Mesh: Filtering

Filtering of meshes.

Notes:

D4LIB_API int d4mesh_smoothAverage (d4mesh_ptr mesh, int smoothing)
 Smooth mesh using an average filter. More...
 
D4LIB_API int d4mesh_reduceMeshDensity (d4mesh_ptr mesh, float factor)
 Reduce the vertex/triangle density of mesh (simplification). More...
 
D4LIB_API int d4mesh_removeSelectedVertices (d4mesh_ptr mesh, const d4mesh_SubmeshVertexIndex *selectedVertices, int selectedVerticesCount)
 Remove selected vertices. More...
 
D4LIB_API int d4mesh_invertTriangleOrientation (d4mesh_ptr mesh)
 Invert orientation of all triangles in given mesh. More...
 
D4LIB_API int d4mesh_removeVerticesByVirtualCamMask (d4mesh_ptr *meshes, int meshCount, const unsigned char *mask, int width, int height, double f, const double world_T_cam[16], bool onlyVisible)
 Remove any vertex i that when projected into a virtual camera view has a mask value of 'mask[i]==true'. More...
 

Mesh: Alignment

Alignment (registration) of meshes.

D4LIB_API int d4mesh_alignPairCoarse (d4mesh_ptr mesh1, d4mesh_ptr mesh2, double *quality, const d4mesh_CoarseAlignParams *params)
 Align 'mesh1' to 'mesh2' coarsely. More...
 
D4LIB_API int d4mesh_alignPairFine (d4mesh_ptr mesh1, d4mesh_ptr mesh2, double *quality, const d4mesh_FineAlignParams *params)
 Align 'mesh1' to 'mesh2' fine. More...
 
D4LIB_API int d4mesh_alignGlobalFine (d4mesh_ptr *meshes, int meshCount, const d4mesh_GlobalFineAlignParams *params)
 Align meshes globally fine. More...
 

Mesh: Fusion

Fusion of meshes and textures into one mesh and one texture.

Notes:

D4LIB_API int d4mesh_fuseGeometry (d4mesh_ptr fusedGeo, d4mesh_ptr *meshes, int meshCount, int resolution, float holeSizeThresRel, int sharpness)
 Fuse multiple meshes into one triangular mesh. More...
 
D4LIB_API int d4mesh_getFuseGeometryResolution (d4mesh_ptr *meshes, int meshCount, int *resolution, double metricResolution)
 Converts a metric resolution value into a resolution value required by d4mesh_fuseGeometry. More...
 
D4LIB_API int d4mesh_fuseTexture (d4mesh_ptr fusedGeo, d4mesh_ptr *meshes, int meshCount)
 Fuse textures referenced by 'meshes' into one texture of 'fusedGeo'. More...
 

Mesh: Import / Export

Import and export of meshes.

See functions for supported formats.

Notes:

D4LIB_API int d4mesh_export (d4mesh_ptr mesh, const char *filename)
 Export 'mesh' to file. More...
 
D4LIB_API int d4mesh_import (d4mesh_ptr mesh, const char *filename)
 Import 'mesh' from file. More...
 

Detailed Description

Provides a low level C interface to 'Scanning' and 'Shape Fusion' functions.

Enumeration Type Documentation

More detailed camera calibration error.

Enumerator
d4calib_CamCalibError_ok 

No error.

d4calib_CamCalibError_MarkerDetection 

Marker detection failed.

d4calib_CamCalibError_MarkerMapping 

Left and right calibration planes do not intersect.

d4calib_CamCalibError_PlaneIntersection 

Left and right calibration planes do not intersect.

d4calib_CamCalibError_LeftPlane 

Calibration of left plane failed.

d4calib_CamCalibError_RightPlane 

Calibration of right plane failed.

d4calib_CamCalibError_ModelFitting 

Could not find valid mapping between measured points and model parameters.

d4calib_CamCalibError_ErrorValuesTooHigh 

The resulting calibration error values are too high.

d4calib_CamCalibError_Unknown 

Unknown calibration error.

Definition at line 654 of file d4lib.h.

More detailed projector calibration error.

Enumerator
d4calib_ProjectorCalibError_ok 

No error.

d4calib_ProjectorCalibError_PhaseImage 

Could not compute phase image from input sequence.

d4calib_ProjectorCalibError_ModelFitting 

Could not find valid mapping between measured points and model parameters.

d4calib_ProjectorCalibError_Unknown 

Unknown calibration error.

Definition at line 668 of file d4lib.h.

All DAVID Low Level Library functions return an error code.

Enumerator
d4ok 

All ok.

d4error_InvalidArgument 

One or more arguments of function call are not valid.

d4error_FormatNotAvailable 

Format is not available.

d4error_InvalidFormat 

Invalid format.

d4error_NoAccess 

General access denied error.

d4error_MissingObject 

Important object is missing.

d4error_OutOfMemory 

Failed to allocate necessary memory.

d4error_Abort 

Operation aborted.

d4error_Fail 

Unspecified failure.

d4error_NotLicensed 

Software license does not support this request.

d4error_NotImplemented 

The requested function is not implemented.

d4error_InvalidPath 

Invalid path syntax.

d4error_FileNotFound 

Could not find the specified file.

d4error_DirectoryNotFound 

Could not find the specified directory.

d4error_MissingFilename 

The specified path does not contain a file name.

d4error_InconsistentBuffer 

Buffer size differs from expected buffer size.

d4error_InvalidVersion 

Invalid or unsupported version.

d4error_DeviceNotAvailable 

Device is not available / not found.

d4error_NoLiveImage 

Can not get live image from camera.

d4error_ActuatorStalled 

Actuator stalled. Required torque might be too high.

d4error_CameraCalibration 

Camera calibration failed.

d4error_ProjectorCalibration 

Projector calibration failed.

d4error_ScanFailed 

Scan failed.

d4error_NotCalibrated 

Scanner is not calibrated.

d4error_AlignFailed 

Alignment failed.

d4error_InvalidMeshId 

One or more mesh IDs are invalid.

Definition at line 102 of file d4lib.h.

Supported replace operations.

Enumerator
d4fimg_ReplaceIfLess 

Replace value if it less than a comparison value.

d4fimg_ReplaceIfGreater 

Replace value if it greater than a comparison value.

Definition at line 329 of file d4lib.h.

Supported pixel formats.

Enumerator
d4img_UnknownPixelFormat 

Pixel format is unknown.

d4img_Y800 

8bit grayscale images.

d4img_RGB24 

24bit RGB images. Byte 0=8bit blue; Byte 1=8bit green; Byte 2=8bit red.

d4img_YUY2 

16bit color format. Byte 0=8bit Y'0; Byte 1=8bit Cb; Byte 2=8bit Y'1; Byte 3=8bit Cr.

d4img_BY8 

8bit bayer color format.

Definition at line 172 of file d4lib.h.

Buffer selection.

Enumerator
d4mesh_VertexPositionBuffer 

The vertex position buffer stores the vertex positions as an array of tuples.

Each vertex position is described by a tuple (x,y,z) of three 32bit floats .
This buffer is always present.
Note
Coordinates are always with respect to the local coordinate system of the mesh.
d4mesh_VertexNormalBuffer 

The vertex normal buffer stores the vertex normals as an array of tuples.

Each vertex normal is described by a tuple (nx,ny,nz) of three 32bit floats.
This buffer is always present.
Note
Coordinates are always with respect to the local coordinate system of the mesh.
d4mesh_VertexTexCoordBuffer 

The texture coordinates buffer stores texture coordinates as an array of tuples.

Each vertex texture coordinate is described a tuple (u,v) of two 32bit floats.
This buffer is only optional.
Note
Coordinates should be in range [0,1].
d4mesh_VertexColorBuffer 

The texture color buffer stores vertex colors as an array of tuples.

Each vertex texture coordinate is described a RGBA tuple (red, green, blue, alpha) of four 8bit unsigned chars.
This buffer is only optional.
Note
Coordinates should be in range [0,1].
d4mesh_TriangleIndexBuffer 

The triangle index buffer stores triangles as an array of vertex indices.

Each triangle is described by tuple (v0, v1, v2) of three 32bit integer vertex indices that are zero based. This buffer is always present.

d4mesh_VertexQualityBuffer 

The vertex quality buffer stores a quality value for each vertex.

This buffer is only optional.
Note
Quality values should be in range [0,1].

Definition at line 931 of file d4lib.h.

Selects the color used for all generated patterns.

Enumerator
d4sls_White 

All color channels are used by same magnitude.

d4sls_Red 

Only red color channel is used.

d4sls_Green 

Only green color channel is used.

d4sls_Blue 

Only blue color channel is used.

Definition at line 753 of file d4lib.h.

Defines orientations for hardware setup.

Enumerator
d4sls_HorizontalOrientation 

Horizontal setup. Projector and camera are next to each other.

d4sls_VerticalOrientation 

Vertical setup. Projector and camera are above each other.

d4sls_BothOrientations 

Diagonal setup. Projector and camera are located diagonally.

Definition at line 762 of file d4lib.h.

Function Documentation

D4LIB_API int d4calib_calibrate ( d4calib_ptr  camCalib,
d4img_ptr  imgCamCalib,
d4calib_ptr  projectorCalib,
d4sls_ptr  sls,
d4img_ptr capturedImages,
int  imageCount,
double  scale,
bool  compensatePatternOffsets,
int *  calibError,
d4calib_CalibPoint calibPoints,
int *  calibPointCount 
)

Standard calibration procedure for one camera and one projector using the corner calibration panels.

Warning
Only d4img_Y800 pixel format is supported for 'imgCamCalib' and 'capturedImages'.
Parameters
[out]camCalibValid pointer to camera calibration object.
[in]imgCamCalibValid pointer to camera image of calibration corner.
[out]projectorCalibValid pointer to projector calibration object.
[in,out]slsValid pointer to structured light scanning object.
[in]capturedImagesValid pointer to an array of image pointers. Every pointer has to be valid and of pixel format d4img_Y800.
[in]imageCountNumber of image pointers in 'capturedImages'.
[in]scaleCalibration scale from panel.
[in]compensatePatternOffsetsUse bundle adjustment to determine offsets of left and right patterns within their respective planes. Set to false, if calibration corner is perfect.
[out]calibErrorOptional pointer to int that gets additional information about calibration error (d4calib_CamCalibError, d4calib_ProjectorCalibError, or d4ok).
[out]calibPointsOptional pointer to array of calibration points that is filled with correspondences used for calibration. See d4calib_CalibPoint.
[in,out]calibPointCountOptional pointer to int. Input: Maximum number of calibration points that fit into 'calibPoints'. Output: Number of calibration points written to 'calibPoints'.
Returns
d4ok, d4error_InvalidArgument, d4error_FormatNotAvailable, d4error_CameraCalibration, d4error_ProjectorCalibration
D4LIB_API int d4calib_changeCalibrationResolution ( d4calib_ptr  calib,
int  newWidth,
int  newHeight 
)

Change resolution of image format used for calibration.

Intrinsics are adapted to this new resolution.

Note
Only available for camera calibration. Projector model uses normalized coordinates.
Warning
The aspect ratio is not allowed to change.
Parameters
[in,out]calibValid pointer to calibration object.
[in]newWidthNew camera image width.
[in]newHeightNew camera image height.
Returns
d4ok, d4error_InvalidArgument, d4error_NotCalibrated, d4error_InvalidFormat
D4LIB_API int d4calib_exportCalibration ( d4calib_ptr  calib,
const char *  filename 
)

Export calibration data to file.

Parameters
[in,out]calibValid pointer to calibration object.
[in]filenameValid pointer to filename string.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4calib_getCalibrationResolution ( d4calib_ptr  calib,
int *  width,
int *  height 
)

Get the resolution of a calibration.

Note
Only available for camera calibration. Projector model uses normalized coordinates.
Parameters
[in]calibValid pointer to calibration object.
[out]widthThe image width.
[out]heightThe image height.
Returns
d4ok, d4error_InvalidArgument, d4error_NotCalibrated
D4LIB_API int d4calib_importCalibration ( d4calib_ptr  calib,
const char *  filename 
)

Import calibration data from file.

Parameters
[in,out]calibValid pointer to calibration object.
[in]filenameValid pointer to filename string.
Returns
d4ok, d4error_InvalidArgument, d4error_FileNotFound, d4error_InvalidFormat
D4LIB_API int d4calib_isCalibrated ( d4calib_ptr  calib,
bool *  calibrated 
)

Is calibration valid?

Parameters
[in,out]calibValid pointer to calibration object.
[out]calibratedValid pointer to bool that gets calibration state: True, if calibrated.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API d4calib_ptr d4calib_newCameraCalibration ( )

Create a new calibration object for cameras.

Returns
Pointer to camera calibration object or NULL in case of an error.
D4LIB_API d4calib_ptr d4calib_newProjectorCalibration ( )

Create a new calibration object for projectors.

Returns
Pointer to projector calibration object or NULL in case of an error.
D4LIB_API int d4cam_captureImageAsync ( d4cam_ptr  cam,
int  minContentChange,
double  maxWaitTime,
int  temporalSmoothCount 
)

Start a new asynchronous image capture.

The function returns immediately. Use d4cam_getCapturedImage to wait for the capturing to be finished. Example:

d4cam_captureImageAsync(cam, 0, 1.0, 0);
// ...
img = NULL;
Parameters
[in,out]camValid pointer to a camera.
[in]minContentChangeHow much has the content of the new image to be different from the previous image? Range: [0,100]%.
[in]maxWaitTimeMaximum wait time [seconds] until an image has to be captured. 'minContentChange' will be ignored when 'maxWaitTime' has been exceeded.
[in]temporalSmoothCountTemporal smoothing: Final image is average of '1+temporalSmoothCount' camera images.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_check ( d4cam_ptr  cam)

Check if camera is open and ok.

Parameters
[in]camPointer to camera.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_close ( d4cam_ptr  cam)

Close camera.

Parameters
[in,out]camValid pointer to camera.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4cam_getAvailableCamerasCount ( d4cam_ptr  cam,
int *  count 
)

Get the number of available cameras.

Can be used in combination with d4cam_getAvailableCamerasName.

Parameters
[in]camValid pointer to camera interface.
[out]countValid pointer to int that gets the number of available cameras.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_getAvailableCamerasName ( d4cam_ptr  cam,
char *  name,
d4size  maxLength,
int  index 
)

Get the name of an available camera.

Can be used in combination with d4cam_getAvailableCamerasCount.

Parameters
[in]camValid pointer to camera interface.
[out]nameValid pointer to string that gets the camera name.
[in]maxLengthMaximum length of 'name'.
[in]indexZero based index of available index.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_getCapturedImage ( d4cam_ptr  cam,
d4img_ptr  img,
int  pixelFormat 
)

Get the captured image.

If a capturing is still in progress (started via d4cam_captureImageAsync), the function will wait until capturing is finished.

Parameters
[in,out]camValid pointer to a camera.
[out]imgValid pointer to an image that gets the captured image.
[in]pixelFormatDesired pixel format (see d4img_PixelFormat). In case of d4img_UnknownPixelFormat, camera pixel format will be used.
Returns
d4ok, d4error_InvalidArgument
d4error_DeviceNotAvailable Camera is not open or does not deliver any images.
d4error_Fail d4cam_captureImageAsync was not called before.
D4LIB_API int d4cam_getImageFormat ( d4cam_ptr  cam,
int *  width,
int *  height,
int *  pixelFormat,
double *  fps 
)

Get the image format of the camera.

Parameters
[in]camValid pointer to camera.
[out]widthOptional pointer to int for width of image. May be NULL.
[out]heightOptioal pointer to int for height of image. May be NULL.
[out]pixelFormatOptional pointer to int for d4img_PixelFormat. May be NULL.
[out]fpsOptional pointer to double for frames per second. May be NULL.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_getProperty ( d4cam_ptr  cam,
double *  value,
const char *  name 
)

Get a camera property.

Parameters
[in,out]camValid pointer to an open camera.
[out]valueValid pointer to double that gets the value.
[in]nameValid string to name of property.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable, d4error_Fail
D4LIB_API int d4cam_getPropertyCount ( d4cam_ptr  cam,
int *  count,
bool  onlyAvailable 
)

Get number of all camera property names or 'onlyAvailable' camera property names.

Parameters
[in,out]camValid pointer to open camera.
[out]countValid pointer to int that gets the count of camera property names.
[in]onlyAvailableList only available camera properties?
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_getPropertyName ( d4cam_ptr  cam,
char *  name,
d4size  maxLength,
int  propertyNameIndex,
bool  onlyAvailable 
)

Get a camera property name.

Warning
Function has be used in combination with d4cam_getPropertyCount and 'onlyAvailable' identical.
Parameters
[in,out]camValid pointer to open camera.
[out]nameValid pointer to string that gets the property name.
[in]maxLengthMaximum length of 'name'.
[in]propertyNameIndexZero based index of a property name. Has to be in range [0, d4cam_getPropertyCount).
[in]onlyAvailableList only available camera properties?
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_getPropertyRange ( d4cam_ptr  cam,
double *  minValue,
double *  maxValue,
double *  defValue,
double *  deltaValue,
const char *  name 
)

Get a camera property range.

Note
Not all values (like 'deltaValue') might be available by every camera.
Parameters
[in,out]camValid pointer to an open camera.
[out]minValueValid pointer to double that gets the minimum value.
[out]maxValueValid pointer to double that gets the maximum value.
[out]defValueValid pointer to double that gets the default value.
[out]deltaValueValid pointer to double that gets the delta value.
[in]nameValid string to name of property.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable, d4error_Fail
D4LIB_API int d4cam_getTimestamp ( d4cam_ptr  cam,
double *  timestamp 
)

Get the timestamp of the last captured image.

Parameters
[in,out]camValid pointer to a camera.
[out]timestampValid pointer to a double that gets the timestamp [seconds].
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API d4cam_ptr d4cam_newDirectShowCamera ( )

Creates a new DirectShow camera instance.

Returns
Pointer to camera object.
D4LIB_API int d4cam_open ( d4cam_ptr  cam,
const char *  name,
int  width,
int  height,
int  pixelFormat,
double  fps 
)

Open camera.

Example:

d4cam_open(cam, "DAVID-CAM-3-M (8F6DEE1E)", 0, 0, d4cam_Y800, 0.0);
d4cam_captureImageAsync(cam, img, 0.0, 1.0, 0);
d4cam_waitForCapture(cam, img);
Parameters
[in,out]camValid pointer to camera.
[in]nameName of the camera.
[in]widthDesired with of the camera forat. Set zero to ignore.
[in]heightDesired height of the camera format. Set zero to ignore.
[in]pixelFormatDesired pixel format. Set to d4cam_UnknownPixelFormat to ignore.
[in]fpsDesired frames per second of the camera format. Set zero to ignore.
Returns
d4ok All ok.
d4error_InvalidArgument One of the arguments is invalid.
d4error_DeviceNotAvailable Selected camera is not available.
d4error_FormatNotAvailable Selected camera image format is invalid.
D4LIB_API int d4cam_pause ( d4cam_ptr  cam)

Set running camera into a paused state.

Camera is automatically resumed when calling any capture function. Resuming a camera from paused state takes some time depeding on the camera driver.

Parameters
[in,out]camValid pointer to a camera.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_setProperty ( d4cam_ptr  cam,
double  value,
const char *  name 
)

Set a camera property.

Parameters
[in,out]camValid pointer to an open camera.
[in]valueValue to be set.
[in]nameNull terminated string of camera name.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4cam_setSkipCount ( d4cam_ptr  cam,
int  skipCount 
)

Set the number of images that are skipped after a content change was detected.

This value will be used when d4cam_captureImageAsync is called with 'minContentChange' > 0. Only set this value when there are problems (e.g. when using rolling shutter camera or image tearing).

Parameters
[in,out]camValid pointer to a camera.
[in]skipCountNumber of images to be skipped. Default value is 1.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4fimg_export ( d4fimg_ptr  img,
const char *  filename 
)

Export float image to file.

Note
Supported file formats: .pfm
Parameters
[in]imgValid pointer to float image.
[in]filenameFilename of image.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_NoAccess, d4error_FormatNotAvailable, d4error_Fail
D4LIB_API int d4fimg_getImageData ( d4fimg_ptr  img,
float *  data,
d4size  size 
)

Get image data.

Parameters
[in]imgValid pointer to an image.
[out]dataDestination buffer for image data.
[in]sizeSize of 'data' in bytes.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4fimg_getImageFormat ( d4fimg_ptr  img,
int *  width,
int *  height 
)

Get format of the float image.

Parameters
[in]imgValid pointer to a float image.
[out]widthPointer to an int that gets the width of the image. May be NULL.
[out]heightPointer to an int that gets the height of the image. May be NULL.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4fimg_import ( d4fimg_ptr  img,
const char *  filename 
)

Import float image from file.

Note
Supported file formats: .pfm
Parameters
[out]imgValid pointer to destination float image.
[in]filenameFilename of image.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_FileNotFound, d4error_NoAccess, d4error_FormatNotAvailable, d4error_Fail
D4LIB_API d4fimg_ptr d4fimg_newImage ( )

Creates a new 32bit float image.

Returns
Pointer to an image or d4null in case of an error.
D4LIB_API int d4fimg_replace ( d4fimg_ptr  img,
float  replaceValue,
d4fimg_ptr  compare,
float  threshold,
int  replaceOp 
)

Replace pixel value by 'replaceValue', if condition is valid.

Otherwise source value is used.

d4fimg_ReplaceIfLess: img[i] = compare[i] < threshold ? replaceValue : img[i];
d4fimg_ReplaceIfGreater: img[i] = compare[i] > threshold ? replaceValue : img[i];
Parameters
[in,out]imgValid source and target image.
[in]replaceValueValue for replacement.
[in]compareValid image that stores mask values for each pixel.
[in]thresholdThreshold value that is used for comparison.
[in]replaceOpDesired replace operation.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4fimg_setFloat ( d4fimg_ptr  img,
float  value 
)

Sets all pixel values to given float value.

Parameters
[in,out]imgValid image.
[in]valueValue to be set.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4fimg_setImageData ( d4fimg_ptr  img,
const float *  data,
d4size  size 
)

Set image data.

Parameters
[out]imgValid pointer to an image.
[in]dataSource buffer for image data.
[in]sizeSize of 'data' in bytes.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4fimg_setImageFormat ( d4fimg_ptr  img,
int  width,
int  height 
)

Set format of the float image.

Parameters
[in]imgValid pointer to a float image.
[out]widthWidth of the image or zero.
[out]heightHeight of the image or zero.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4img_applyWhiteBalance ( d4img_ptr  img,
double  redFactor,
double  greenFactor,
double  blueFactor 
)

Apply white balance correction to 'img'.

Note
Supported image formats: d4img_RGB24
Parameters
[in,out]imgValid pointer to image that should be corrected.
[in]redFactorRed correction factor > 0.
[in]greenFactorGreen correction factor > 0.
[in]blueFactorBlue correction factor > 0.
Returns
d4ok, d4error_InvalidArgument, d4error_FormatNotAvailable
D4LIB_API int d4img_computeColorImage ( d4img_ptr  outputColorImage,
d4img_ptr inputGrayImages,
int  inputImageCount 
)

Compute a color image from 3 or 4 grayscale images that were capture under specific lighting conditions.

Parameters
[out]outputColorImageValid pointer to output image. Output pixel format will be set d4img_RGB24. Width and height will be set to width and height of input images.
[in]inputGrayImagesValid pointer to an array of 3 or 4 image pointers. The following conditions have to be met:
  • All input images have to be of the same width and height.
  • All input images have to be of pixel format d4img_Y800.
  • Ordering has to be red, green, blue, and optional black image.
[in]inputImageCountNumber of input images. Has to be 3 or 4.
Returns
d4ok, d4error_InvalidArgument, d4error_FormatNotAvailable
D4LIB_API int d4img_computeWhiteBalance ( d4img_ptr  img,
double *  redFactor,
double *  greenFactor,
double *  blueFactor 
)

Compute white balance parameters.

The color image has to be captured with a white background.

Note
See d4img_convert for supported image formats.
Parameters
[in]imgValid pointer to input to a color image.
[out]redFactorValid pointer to double that gets the scaling factor for red color component.
[out]greenFactorValid pointer to double that gets the scaling factor for green color component.
[out]blueFactorValid pointer to double that gets the scaling factor for blue color component.
Returns
d4ok, d4error_InvalidArgument, d4error_FormatNotAvailable
D4LIB_API int d4img_convert ( d4img_ptr  destImg,
int  pixelFormat,
d4img_ptr  srcImg 
)

Set the image data.

Image data is converted, if 'pixelFormat' does not fit.

Parameters
[out]destImgValid pointer to destination image.
[in]pixelFormatPixel format of data array. See d4img_PixelFormat. When set to d4img_UnknownPixelFormat, image data is just copied.
[in]srcImgValid pointer to source image.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4img_export ( d4img_ptr  img,
const char *  filename 
)

Export image to file.

Note
Supported file formats: .bmp, .png
Supported image formats: d4img_RGB24
Parameters
[in]imgValid pointer to destination image.
[in]filenameFilename of image.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_NoAccess, d4error_FormatNotAvailable, d4error_Fail
D4LIB_API int d4img_getImageData ( d4img_ptr  img,
void *  data,
d4size  size,
int  pixelFormat 
)

Get image data.

Image data is converted, if 'pixelFormat' does not fit.

Parameters
[in]imgValid pointer to an image.
[out]dataDestination buffer for image data.
[in]sizeSize of destination buffer in bytes.
[in]pixelFormatDesired pixel format. See d4img_PixelFormat. When set to d4img_UnknownPixelFormat, pixel format of 'img' is used.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4img_getImageFormat ( d4img_ptr  img,
int *  width,
int *  height,
int *  pixelFormat 
)

Get format of the image.

Parameters
[in]imgValid pointer to an image.
[out]widthPointer to int for width of image. May be NULL.
[out]heightPointer to int for height of image. May be NULL.
[out]pixelFormatPointer to int for d4img_PixelFormat. May be NULL.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4img_import ( d4img_ptr  img,
const char *  filename 
)

Import image from file.

Note
Supported file formats: .bmp
Supported image formats: d4img_RGB24
Parameters
[out]imgValid pointer to destination image.
[in]filenameFilename of image.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_FileNotFound, d4error_NoAccess, d4error_FormatNotAvailable, d4error_Fail
D4LIB_API d4img_ptr d4img_newImage ( )

Creates a new image.

Returns
Pointer to an image or NULL in case of an error.
D4LIB_API int d4img_setImageData ( d4img_ptr  img,
const void *  data,
d4size  size,
int  pixelFormat 
)

Set the image data.

Image data is converted, if 'pixelFormat' does not fit.

Parameters
[out]imgValid pointer to an image.
[in]dataValid pointer it image data array.
[in]sizeSize of image data array in bytes.
[in]pixelFormatPixel format of data array. See d4img_PixelFormat. When set to d4img_UnknownPixelFormat, pixel format of 'img' is used.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4img_setImageFormat ( d4img_ptr  img,
int  width,
int  height,
int  pixelFormat 
)

Set format of the image.

Parameters
[out]imgValid pointer to an image.
[in]widthWidth of the image or zero.
[in]heightHeight of the image or zero.
[in]pixelFormatSee d4img_PixelFormat. d4img_UnknownPixelFormat is allowed.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4lib_getVersion ( char *  version,
d4size  maxLength 
)

Get version of library.

Parameters
[out]versionValid pointer to string that gets the version.
[in]maxLengthMaximum string length inlucing null terminator that fits into 'version'.
D4LIB_API int d4lib_init ( const char *  licenseKey)

Initialize DAVID Low Level Library.

Parameters
[in]licenseKeyLicense key. Only required for special/future versions - normally please use nullptr
Returns
d4ok, d4error_NotLicensed
D4LIB_API int d4lib_release ( )

Release DAVID Low Level Library.

Returns
d4ok
D4LIB_API int d4mem_decRefCount ( void *  ptr)

Decrement the reference count for the object identified by 'ptr'.

Parameters
[in,out]ptrValid pointer to the object.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mem_incRefCount ( void *  ptr)

Increment the reference count for the object identified by 'ptr'.

The object is deleted when the reference count reaches zero.

Parameters
[in,out]ptrValid pointer to the object.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_alignGlobalFine ( d4mesh_ptr meshes,
int  meshCount,
const d4mesh_GlobalFineAlignParams params 
)

Align meshes globally fine.

Parameters
[in,out]meshesValid pointer to an array of valid mesh pointers.
[in]meshCountNumber of meshes referenced by 'meshes'.
[in]paramsValid pointer to alignment parameter set. See d4mesh_GlobalFineAlignParams.
Returns
d4ok, d4error_InvalidArgument, d4error_Fail
D4LIB_API int d4mesh_alignPairCoarse ( d4mesh_ptr  mesh1,
d4mesh_ptr  mesh2,
double *  quality,
const d4mesh_CoarseAlignParams params 
)

Align 'mesh1' to 'mesh2' coarsely.

Parameters
[in,out]mesh1Valid pointer to mesh that is moved (aligned).
[in]mesh2Valid pointer to mesh.
[out]qualityOptional pointer to double that gets quality value in range [-1,1]=[bad,good].
[in]paramsValid pointer to alignment parameter set. See d4mesh_CoarseAlignParams.
Returns
d4ok, d4error_InvalidArgument, d4error_Fail
D4LIB_API int d4mesh_alignPairFine ( d4mesh_ptr  mesh1,
d4mesh_ptr  mesh2,
double *  quality,
const d4mesh_FineAlignParams params 
)

Align 'mesh1' to 'mesh2' fine.

Parameters
[in,out]mesh1Valid pointer to mesh that is moved (aligned).
[in]mesh2Valid pointer to mesh.
[out]qualityOptional pointer to double that gets quality value in range [-1,1]=[bad,good].
[in]paramsValid pointer to alignment parameter set. See d4mesh_FineAlignParams.
Returns
d4ok, d4error_InvalidArgument,# d4error_Fail
D4LIB_API int d4mesh_clear ( d4mesh_ptr  mesh)

Clear all data of mesh object.

Parameters
[in,out]meshValid pointer to mesh object.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_combine ( d4mesh_ptr  meshGroup,
d4mesh_ptr meshesToCombine,
int  meshCount 
)

Combine multiple meshes into submeshes of a single mesh.

Parameters
[out]meshGroupValid pointer to a mesh object. Must not be part of 'meshesToCombine'.
[in]meshesToCombinePointer to array of valid pointers to mesh objects that have to be combined.
[in]meshCountNumber of meshes referenced by 'meshesToCombine'.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_copy ( d4mesh_ptr  targetMesh,
d4mesh_ptr  sourceMesh 
)

Copy mesh data from 'sourceMesh' to 'targetMesh'.

Old content of 'targetMesh' is deleted.

Parameters
[out]targetMeshValid pointer to target mesh object.
[in]sourceMeshValid pointer to source mesh object.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_export ( d4mesh_ptr  mesh,
const char *  filename 
)

Export 'mesh' to file.

Supported formats: OBJ, STL, PLY

Warning
Texture is only exported, if there is only one submesh (see d4mesh_getSubmeshCount).
Parameters
[in]meshValid pointer to mesh.
[in]filenameValid pointer to string with filename.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_FileNotFound, d4error_NoAccess
D4LIB_API int d4mesh_fuseGeometry ( d4mesh_ptr  fusedGeo,
d4mesh_ptr meshes,
int  meshCount,
int  resolution,
float  holeSizeThresRel,
int  sharpness 
)

Fuse multiple meshes into one triangular mesh.

Parameters
[out]fusedGeoValid pointer to fusion result.
[in]meshesValid pointer to an array of valid mesh pointers.
[in]meshCountNumber of meshes referenced by 'meshes'.
[in]resolutionLimits the maximum resolution and thus the required memory usage.
[in]holeSizeThresRelHoles, which have a smaller area than holeSizeThresRel * size of original data surface, will be closed. 0 = open all holes. 1 = close all holes.
[in]sharpnessFusion sharpness in [-3,+5]. Negative values for smoothing. Default is 1.
Returns
d4ok, d4error_InvalidArgument, d4error_Fail
D4LIB_API int d4mesh_fuseTexture ( d4mesh_ptr  fusedGeo,
d4mesh_ptr meshes,
int  meshCount 
)

Fuse textures referenced by 'meshes' into one texture of 'fusedGeo'.

Parameters
[in,out]fusedGeoValid pointer to a mesh.
[in]meshesValid pointer to an array of valid mesh pointers.
[in]meshCountNumber of meshes referenced by 'meshes'.
Returns
d4ok, d4error_InvalidArgument, d4error_Fail
D4LIB_API int d4mesh_getBuffer ( d4mesh_ptr  mesh,
void *  data,
d4size  size,
int  bufferType,
int  submeshIndex 
)

Copy requested buffer ('bufferType') content into 'data'.

You can use d4mesh_getVertexCount, d4mesh_getTriangleCount, and d4mesh_getBufferSize to compute the correct size of 'data'.

Parameters
[in]meshValid pointer to a mesh object.
[out]dataValid pointer to data buffer.
[in]sizeSize of 'data' buffer in bytes.
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_getBufferSize ( d4mesh_ptr  mesh,
d4size size,
int  bufferType,
int  submeshIndex 
)

Get size of buffer 'bufferType' in bytes (for all submeshes).

Parameters
[in]meshValid pointer to a mesh object.
[out]sizeValid pointer to value that gets the size of the buffer in bytes. Size will be set to zero if buffer is not available.
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_getFuseGeometryResolution ( d4mesh_ptr meshes,
int  meshCount,
int *  resolution,
double  metricResolution 
)

Converts a metric resolution value into a resolution value required by d4mesh_fuseGeometry.

It uses the maximum bounding box length of all 'meshes'.

Parameters
[in]meshesValid pointer to an array of valid mesh pointers.
[in]meshCountNumber of meshes referenced by 'meshes'.
[out]resolutionValid pointer to resolution value that can be used in d4mesh_fuseGeometry.
[in]metricResolutionSmallest possible element size in units (e.g. 0.1 [mm]).
Returns
d4ok, d4error_InvalidArgument, d4error_Fail
D4LIB_API int d4mesh_getName ( d4mesh_ptr  mesh,
char *  name,
d4size  maxLength 
)

Get the name of a mesh.

Parameters
[in]meshValid pointer to a mesh object.
[out]nameValid pointer to string that gets the name.
[in]maxLengthMaximum length of a string that fits into 'name'.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_getPose ( d4mesh_ptr  mesh,
double  world_T_local[16] 
)

Get the position and orientation (pose) of a mesh.

The pose is represented as a homogenenous transformation matrix:

| nx ox ax px | = | d0 d4 d8 d12 |
| ny oy ay py | = | d1 d5 d9 d13 |
| nz oz az pz | = | d2 d6 d10 d14 |
| 0 0 0 1 | = | d3 d7 d11 d15 |
world_T_local = (d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15)

Some notes:

  • The 3D vector (nx, ny, nz) is the x axis of the local coordinate system with respect to world coordinates.
  • The 3D vector (ox, oy, oz) is the y axis of the local coordinate system with respect to world coordinates.
  • The 3D vector (ax, ay, az) is the z axis of the local coordinate system with respect to world coordinates.
  • The 3D vector (px, py, pz) is the position of the mesh with respect to world coordinates.

This matrix transforms local coordinates into world coordinates:

(wPx, wPy, wPz, 1)^T = world_T_local * (lPx, lPy, lPz, 1)^T
Parameters
[in]meshValid pointer to a mesh.
[out]world_T_localValid pointer to an array of 16 double values.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_getSubmeshCount ( d4mesh_ptr  mesh,
int *  count 
)

Get the number of submeshes (combined meshes) in 'mesh'.

A mesh has at least one submesh. This is also the standard case unless d4mesh_combine or d4mesh_setSubmeshCount was used.

Parameters
[in]meshValid pointer to a mesh object.
[out]countValid pointer to int that gets number of combined meshes in 'mesh'.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API d4img_ptr d4mesh_getTexture ( d4mesh_ptr  mesh,
int  submeshIndex 
)

Get the texture of a mesh.

Textures are optional.

Parameters
[in]meshValid pointer to a mesh object.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
Pointer to an image or NULL. Reference count is incremented.
D4LIB_API int d4mesh_getTriangleCount ( d4mesh_ptr  mesh,
int *  triangleCount,
int  submeshIndex 
)

Get the number of triangles (total count for all submeshes).

Parameters
[in]meshValid pointer to a mesh object.
[out]triangleCountValid pointer to int that gets the number of triangles.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_getVertexCount ( d4mesh_ptr  mesh,
int *  vertexCount,
int  submeshIndex 
)

Get the number of vertices for a given submesh of a mesh.

Parameters
[in]meshValid pointer to a mesh object.
[out]vertexCountValid pointer to int that gets the number of vertices.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_hasBuffer ( d4mesh_ptr  mesh,
bool *  hasBuffer,
int  bufferType,
int  submeshIndex 
)

Is the buffer 'bufferType' available? See d4mesh_BufferType for information about which buffers are optional.

Parameters
[in]meshValid pointer to a mesh object.
[out]hasBufferValid pointer to bool that gets answer.
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_hasTexture ( d4mesh_ptr  mesh,
bool *  hasTexture,
int  submeshIndex 
)

Has 'mesh' a texture?

Parameters
[in]meshValid pointer to a mesh.
[out]hasTextureValid pointer to a bool that gets the answer.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_import ( d4mesh_ptr  mesh,
const char *  filename 
)

Import 'mesh' from file.

Supported formats: OBJ

Parameters
[out]meshValid pointer to mesh.
[in]filenameValid pointer to string with filename.
Returns
d4ok, d4error_InvalidArgument, d4error_InvalidPath, d4error_FileNotFound, d4error_NoAccess
D4LIB_API int d4mesh_invertTriangleOrientation ( d4mesh_ptr  mesh)

Invert orientation of all triangles in given mesh.

Parameters
[in,out]meshValid pointer to a mesh.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API d4mesh_ptr d4mesh_newMesh ( )

Create new mesh object.

Returns
Pointer to mesh object or NULL.
D4LIB_API int d4mesh_reduceMeshDensity ( d4mesh_ptr  mesh,
float  factor 
)

Reduce the vertex/triangle density of mesh (simplification).

Parameters
[in,out]meshValid pointer to a mesh.
[in]factor0.5f for retaining 50% of all triangles, 0.1f for 10% triangles...
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_removeSelectedVertices ( d4mesh_ptr  mesh,
const d4mesh_SubmeshVertexIndex selectedVertices,
int  selectedVerticesCount 
)

Remove selected vertices.

Referenced triangles are also removed. A vertex i is selected if selected[i]==true.

Parameters
[in,out]meshValid pointer to a mesh.
[in]selectedVerticesValid pointer to an array of indices to vertices which should be removed.
[in]selectedVerticesCountNumber of indices in 'selectedVertices'.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_removeVerticesByVirtualCamMask ( d4mesh_ptr meshes,
int  meshCount,
const unsigned char *  mask,
int  width,
int  height,
double  f,
const double  world_T_cam[16],
bool  onlyVisible 
)

Remove any vertex i that when projected into a virtual camera view has a mask value of 'mask[i]==true'.

Vertices outside view or with a mask value fo 'mask[i]==false' are not removed. If a vertex is removed, its referenced triangles are also removed. The virtual camera is described by a perspective camera model:

  • Central z axis goes through center of image –> Center is at (width/2, height/2).
  • Image plane has a size in x-direction of 'width and a size of 'height' in y-direction.
  • x-axis is from left to right and y-axis from top to down (with respect to image).
  • Camera looks along the positive z-axis.
  • Visible points are on positive side of z-axis.
  • Focal length is given by 'f'.
  • Pose of the camera with respect to world coordinates is given by 'world_T_cam'.
Parameters
[in,out]meshesValid pointer to an array of valid mesh pointers.
[in]meshCountNumber of meshes referenced by 'meshes'.
[in]maskValid pointer to an boolean array of size 'width*height'. True: Vertex should be removed. False: Keep vertex.
[in]widthWidth of the mask image [pixel]. Has to be > 0.
[in]heightHeight of the mask image [pixel]. Has to be > 0.
[in]fFocal length (distance of image plane to origin camera coordinate system).
[in]world_T_camPosition and orientation (pose) of the camera with respect to world coordinates. The pose is represented as a homogenenous transformation matrix. See d4mesh_getPose for more information.
[in]onlyVisibleRemove only visible vertices? WARNING: At the moment, only 'onlyVisible==false' is supported.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setBuffer ( d4mesh_ptr  mesh,
const void *  data,
d4size  size,
int  bufferType,
int  submeshIndex 
)

Copy 'data' into the desired buffer ('bufferType').

You can use d4mesh_getVertexCount, d4mesh_getTriangleCount, and d4mesh_getBufferSize to compute the correct size of 'data'.

Parameters
[out]meshValid pointer to a mesh object.
[in]dataValid pointer to data buffer.
[in]sizeSize of 'data' buffer in bytes.
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setName ( d4mesh_ptr  mesh,
const char *  name 
)

Set the name of a mesh.

Parameters
[in]meshValid pointer to a mesh object.
[out]nameValid pointer to a string.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setPose ( d4mesh_ptr  mesh,
const double  world_T_local[16] 
)

Set the position and orientation (pose) of a mesh.

The pose is represented as a homogenenous transformation matrix.

See Also
d4mesh_getPose for a more detailed description.
Parameters
[in,out]meshValid pointer to a mesh.
[in]world_T_localValid pointer to an array of 16 double values describing the transformation matrix.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setSubmeshCount ( d4mesh_ptr  mesh,
int  count 
)

Set the number of submeshes (combined meshes) in 'mesh'.

Parameters
[in]meshValid pointer to a mesh object.
[in]countNew number of submeshes (>0).
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setTexture ( d4mesh_ptr  mesh,
d4img_ptr  image,
int  submeshIndex 
)

Set the texture of a mesh.

Textures are optional.

Parameters
[in,out]meshValid pointer to a mesh object.
[in,out]imageValid pointer to an image. Reference count is incremented, no copy is made.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setTriangleCount ( d4mesh_ptr  mesh,
int  triangleCount,
int  submeshIndex 
)

Set the number of triangles for a given submesh of a mesh.

Parameters
[in]meshValid pointer to a mesh object.
[in]triangleCountNew triangle count.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_setVertexCount ( d4mesh_ptr  mesh,
int  vertexCount,
int  submeshIndex 
)

Set the number of vertices for a given submesh of a mesh.

Parameters
[in]meshValid pointer to a mesh object.
[in]vertexCountNew vertex count.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see d4mesh_getSubmeshCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_smoothAverage ( d4mesh_ptr  mesh,
int  smoothing 
)

Smooth mesh using an average filter.

Parameters
[in,out]meshValid pointer to a mesh.
[in]smoothingNumber of smoothing steps.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4mesh_uncombine ( d4mesh_ptr  meshGroup,
d4mesh_ptr uncombinedMeshes,
int  meshCount 
)

Uncombine submeshes of 'meshGroup' into independent meshes.

'meshCount' has to be equal to the submesh count of 'mesh' (see d4mesh_getSubmeshCount).

Parameters
[in]meshGroupValid pointer to a mesh object that contains combined meshes. Must not be part of 'uncombinedMeshes'.
[out]uncombinedMeshesPointer to array of valid pointers to mesh objects that get the uncombined meshes.
[in]meshCountNumber of meshes referenced by 'uncombinedMeshes'.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4projector_check ( d4projector_ptr  projector)

Check if projector is open and ok.

Parameters
[in]projectorPointer to projector.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4projector_close ( d4projector_ptr  projector)

Closes the connection to the projector.

Parameters
[in,out]projectorValid pointer to the projector.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4projector_displayImage ( d4projector_ptr  projector,
d4img_ptr  img 
)

Display an image.

Warning
'img' has to be of the format given by d4projector_getImageFormat.
Parameters
[in,out]projectorValid pointer to the projector.
[in]imgImage to be displayed. Must have same format as d4projector_getImageFormat.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4projector_displayUniformColor ( d4projector_ptr  projector,
unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

Display an image with a uniform color.

Parameters
[in,out]projectorValid pointer to the projector.
[in]redRed color component [0,255].
[in]greenGreen color component [0,255].
[in]blueBlue color component [0,255].
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4projector_getImageFormat ( d4projector_ptr  projector,
int *  width,
int *  height,
int *  pixelFormat 
)

Get image format for displaying images.

Parameters
[in,out]projectorValid pointer to the projector.
[out]widthOptional pointer to int that gets width of image [px].
[out]heightOptional pointer to int that gets height of image [px].
[out]pixelFormatOptional pointer to int that gets pixel format of image (see d4img_PixelFormat).
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API int d4projector_getScreenCount ( d4projector_ptr  projector,
int *  screenCount 
)

Get the number of available screens.

Should be used in combination with d4projector_getScreenFormat.

Parameters
[in,out]projectorValid pointer to the projector.
[out]screenCountValid pointer to int that gets the number of available screens.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4projector_getScreenFormat ( d4projector_ptr  projector,
int *  x,
int *  y,
int *  width,
int *  height,
int  screenID 
)

Get screen dimensions and position for requested screen.

Should be used in combination with d4projector_getScreenCount.

Parameters
[in,out]projectorValid pointer to the projector.
[out]xOptional pointer to int that gets x position of screen [px].
[out]yOptional pointer to int that gets x position of screen [px].
[out]widthOptional pointer to int that gets width of screen [px].
[out]heightOptional pointer to int that gets height of screen [px].
[in]screenIDID of the desired screen. First screen has ID 1. Use in combination with d4projector_getScreenCount.
Returns
d4ok, d4error_InvalidArgument, d4error_DeviceNotAvailable
D4LIB_API d4projector_ptr d4projector_newExtendedDisplayProjector ( )

Creates a new projector using extended display.

Returns
Pointer to projector object or NULL in case of an error.
D4LIB_API int d4projector_openByScreenID ( d4projector_ptr  projector,
int  screenID 
)

Establish the connection to a projector by given 'screenID'.

Parameters
[in,out]projectorValid pointer to the projector.
[in]screenIDID of the desired screen. First screen has ID 1. Use in combination with d4projector_getScreenCount.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4scan_convertDepthImageToMesh ( d4mesh_ptr  mesh,
d4fimg_ptr  depthImage,
d4fimg_ptr  qualityImage,
d4calib_ptr  calib,
float  minDepth,
float  maxDepth,
float  depthThres,
float  minQuality,
double  outlierRemoval 
)

Compute mesh from a depth image.

For every pixel of the depth image with a depth value in range [minDepth, maxDepth] a vertex is generated. Neighbouring vertices are triangulated. Vertices that are not referenced by any triangle are removed.

Parameters
[out]meshValid pointer to a mesh.
[in]depthImageValid pointer to a depth image.
[in]qualityImageOptional pointer to a quality image with values in range [0,1]=[bad,good].
[in]calibValid (camera) calibration.
[in]minDepthMinimum depth value in [mm]. Has to be > 0.
[in]maxDepthMaximum depth value in [mm]. Has to be > 'minDepth'.
[in]depthThresNeighbor pixels to a triangle will not be connected, if their difference in depth is larger than this value [mm].
[in]minQualityMinimum quality value. Only used if 'qualityImage' is a valid pointer.
[in]outlierRemovalOutlier filter, removing smallest fragments. 0=off. 1=remove all except the largest fragment. e.g. 0.1=remove all fragments that are smaller than 10% of the largest fragment.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4scan_removeBackground ( d4fimg_ptr  depthImage,
d4fimg_ptr  backgroundImage,
float  epsilon 
)

Remove background scan from current scan.

All depth values that are farther away the the background, are set to -1:

depthImage[i] = (depthImage[i] < backgroundImage[i] - epsilon) ? depthImage[i] : -1.f;
Parameters
[in,out]depthImageValid pointer to depth image that represents the current scan.
[in]backgroundImageValid pointer to depth image that represents the background scan.
[in]epsilonExpand background scan by this amount into the direction of the cameras origin.
D4LIB_API int d4sls_computeDepthImage ( d4sls_ptr  sls,
d4fimg_ptr  depthImage,
d4fimg_ptr  qualityImage,
d4img_ptr capturedImages,
int  imageCount,
d4calib_ptr  camCalib,
d4calib_ptr  projectorCalib,
int  minContrast 
)

Compute depth image that represents the current scan.

Warning
At the moment, only d4img_Y800 is supported for captured images.
Parameters
[in,out]slsValid pointer to Structured Light Scanning instance.
[out]depthImageValid pointer to float image that gets depth values for each pixel of the camera.
[out]qualityImageOptional pointer to float image that gets quality values for each depth value.
[in]capturedImagesValid pointer to an array of image pointers. Every pointer has to be valid and of pixel format d4img_Y800.
[in]imageCountNumber of image pointers in 'capturedImages'.
[in]camCalibValid pointer to camera calibration object.
[in]projectorCalibValid pointer to projector calibration object.
[in]minContrastMinimum required contrast (magnitude of amplitude signal). Set to <= 0 in order to use default value (10).
Returns
d4ok, d4error_InvalidArgument, d4error_NotCalibrated
D4LIB_API int d4sls_getChessboardImage ( d4sls_ptr  sls,
d4img_ptr  img,
int  width,
int  height,
int  pixelFormat,
d4calib_ptr  projectorCalib,
double  scale 
)

Get special chessboard image that can be used to validate a calibration performed by d4calib_calibrate.

Parameters
[in,out]slsValid pointer to Structured Light Scanning instance.
[out]imgValid pointer to image for pattern.
[in]widthDesired image width [px].
[in]heightDesired image height [px].
[in]pixelFormatDesired pixel format, see d4img_PixelFormat. Supported formats are:
  • d4img_RGB24
[in]projectorCalibValid pointer to projector calibration.
[in]scaleScale used for calibration.
Returns
d4ok, d4error_InvalidArgument, d4error_NotCalibrated
d4error_InvalidFormat Selected pixel format is not supported.
D4LIB_API int d4sls_getCodedLightPhaseShiftParams ( d4sls_ptr  sls,
d4sls_CodedLightPhaseShiftParams params 
)

Get parameters for 'cl+ps' mode.

Parameters
[in,out]slsValid pointer to a SLS instance.
[out]paramsValid pointer to parameters.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4sls_getPatternCount ( d4sls_ptr  sls,
int *  patternCount 
)

Get number of pattern in a scanning sequence.

Parameters
[in,out]slsValid pointer to a SLS instance.
[out]patternCountValid pointer to int that gets the pattern count.
Returns
d4ok, d4error_InvalidArgument
D4LIB_API int d4sls_getPatternImage ( d4sls_ptr  sls,
d4img_ptr  img,
int  width,
int  height,
int  pixelFormat,
int  patternIndex 
)

Get pattern image at 'patternIndex'.

Parameters
[in,out]slsValid pointer to Structured Light Scanning instance.
[out]imgValid pointer to image for pattern.
[in]widthDesired image width [px].
[in]heightDesired image height [px].
[in]pixelFormatDesired pixel format, see d4img_PixelFormat. Supported formats are:
  • d4img_RGB24
[in]patternIndexValid zero based index of pattern.
See Also
d4sls_getPatternCount.
Returns
d4ok, d4error_InvalidArgument
d4error_InvalidFormat Selected pixel format is not supported.
D4LIB_API int d4sls_getSetupImage ( d4sls_ptr  sls,
d4img_ptr  img,
int  width,
int  height,
int  pixelFormat 
)

Get special image for setup.

Parameters
[in,out]slsValid pointer to Structured Light Scanning instance.
[out]imgValid pointer to image for pattern.
[in]widthDesired image width [px].
[in]heightDesired image height [px].
[in]pixelFormatDesired pixel format, see d4img_PixelFormat. Supported formats are:
  • d4img_RGB24
Returns
d4ok, d4error_InvalidArgument
d4error_InvalidFormat Selected pixel format is not supported.
D4LIB_API d4sls_ptr d4sls_newStructuredLightScanner ( )

Create new SLS object.

Returns
Pointer to SLS object or NULL.
D4LIB_API int d4sls_planesToDepthImage ( d4sls_ptr  sls,
d4fimg_ptr  depthImage,
d4calib_ptr  camCalib,
int  numPlanes,
const d4sls_Plane planes 
)

Computes a depth image from a list of planes.

Parameters
[in]slsValid pointer to Structured Light Scanning instance.
[out]depthImageValid pointer to float image that gets depth values for each pixel of the camera.
[in]camCalibValid pointer to camera calibration object.
[in]numPlanesNumber of planes given by parameter "planes".
[in]planesArray of d4sls_Plane structs.
Returns
d4ok, d4error_InvalidArgument, d4error_NotCalibrated
D4LIB_API int d4sls_setCodedLightPhaseShiftParams ( d4sls_ptr  sls,
const d4sls_CodedLightPhaseShiftParams params 
)

Set parameters for 'cl+ps' mode.

Note
By setting parameters the 'cl+ps' will be activated automatically. 'cl+ps' is active by default.
Parameters
[in,out]slsValid pointer to a SLS instance.
[out]paramsValid pointer to parameters.
Returns
d4ok, d4error_InvalidArgument