EDT PDV SDK Documentation 6.2.0

Functions

int pdv_get_htaps_vtaps (PdvDev pdv_p, int *htaps, int *vtaps)
 Get htaps and vtaps setting values. More...
 
int pdv_get_hskip_vskip (PdvDev pdv_p, int *hskip, int *vskip)
 Get hskip and vskip setting values. More...
 
int pdv_get_hactv_vactv (PdvDev pdv_p, int *hactv, int *vactv)
 Get hactv and vactv setting values. More...
 
int pdv_get_fv_once (PdvDev pdv_p)
 Get value of fv_once (frame valid once) flag. More...
 
void pdv_set_full_bayer_parameters (int nSourceDepth, double scale[3], double gamma, int nBlackOffset, int bRedRowFirst, int bGreenPixelFirst, int quality, int bias, int gradientcolor)
 
const char * pdv_get_camera_type (PdvDev pdv_p)
 
const char * pdv_get_camera_class (PdvDev pdv_p)
 Gets the class of the camera (usually the manufacturer name), as set by initcam from the camera_config file camera_class directive. More...
 
const char * pdv_get_camera_model (PdvDev pdv_p)
 Gets the model of the camera, as set by initcam from the camera_config file camera_model directive. More...
 
const char * pdv_get_camera_info (PdvDev pdv_p)
 Gets the string set by the camera_info configuration file directive. More...
 
int pdv_set_width (PdvDev pdv_p, int value)
 Sets width and reallocates buffers accordingly. More...
 
int pdv_get_width (PdvDev pdv_p)
 Gets the width of the image (number of pixels per line), based on the camera in use. More...
 
int pdv_get_pitch (PdvDev pdv_p)
 Gets the number of bytes per line. More...
 
int pdv_set_height (PdvDev pdv_p, int value)
 Sets height and reallocates buffers accordingly. More...
 
int pdv_get_height (PdvDev pdv_p)
 Gets the height of the image (number of lines), based on the camera in use. More...
 
int pdv_get_frame_height (PdvDev pdv_p)
 Gets the height of a single image when the system is configured for multiple images per buffer. More...
 
int pdv_set_depth_extdepth_dpath (PdvDev pdv_p, int depth, int extdepth, unsigned int dpath)
 Sets the bit depth, extended depth, and camera link data path. More...
 
int pdv_get_depth (PdvDev pdv_p)
 Gets the depth of the image (number of bits per pixel), as set in the configuration file for the camera in use. More...
 
int pdv_get_extdepth (PdvDev pdv_p)
 Gets the extended depth of the camera. More...
 
void pdv_cl_set_base_channels (PdvDev pdv_p, int htaps, int vtaps)
 Set the number of channels (taps) and horizontal and vertical alignment of the taps. More...
 
int pdv_set_shutter_method (PdvDev pdv_p, int method, unsigned int mcl)
 Set the device's exposure method and CC line state. More...
 
int pdv_get_shutter_method (PdvDev pdv_p, unsigned int *mcl)
 Returns the shutter (expose) timing method and mode control (CC) state. More...
 
int pdv_get_interlace_method (PdvDev pdv_p)
 Returns the interleave method, as set from the method_interlace directive in the configuration file (from pdv_initcam()). This method is used to determine how the image data will be rearranged (if at all) before being returned from pdv_wait_images() or pdv_read(). More...
 
int pdv_set_exposure (PdvDev pdv_p, int value)
 Sets the exposure time, using the method defined by the directives in the camera configuration file, if set. More...
 
int pdv_get_exposure (PdvDev pdv_p)
 Gets the exposure time on the digital imaging device. More...
 
int pdv_set_gain (PdvDev pdv_p, int value)
 Sets the gain on the input device. More...
 
int pdv_get_gain (PdvDev pdv_p)
 Gets the gain on the device. More...
 
int pdv_set_blacklevel (PdvDev pdv_p, int value)
 Sets the black level (offset) on the input device. More...
 
int pdv_get_blacklevel (PdvDev pdv_p)
 Gets the black level (offset) on the imaging device. More...
 
int pdv_set_binning (PdvDev pdv_p, int xval, int yval)
 Set binning on the camera to the specified values, and recalculate the values that will be returned by pdv_get_width(), pdv_get_height(), and pdv_get_image_size(). More...
 
void pdv_set_start_delay (PdvDev pdv_p, int delay_ms)
 Set the time to wait between acquiring images. More...
 
int pdv_get_start_delay (PdvDev pdv_p)
 Get the time to wait between acquiring images. More...
 
int pdv_enable_roi (PdvDev pdv_p, int flag)
 Enables on-board region of interest. More...
 
int pdv_get_roi_enabled (PdvDev pdv_p)
 Read if region of interest (ROI) is enabled. More...
 
int pdv_set_roi (PdvDev pdv_p, int hskip, int hactv, int vskip, int vactv)
 Sets a rectangular region of interest, supporting cropping. More...
 
int pdv_auto_set_roi (PdvDev pdv_p)
 Set ROI to camera width/height; adjust ROI width to be a multiple of 4, and enable ROI. More...
 
int pdv_set_cam_width (PdvDev pdv_p, int value)
 Sets placeholder for original full camera frame width, unaffected by ROI changes and usually only called by pdv_initcam. More...
 
int pdv_set_cam_height (PdvDev pdv_p, int value)
 Sets placeholder for original full camera frame height, unaffected by ROI changes and usually only called by pdv_initcam. More...
 
int pdv_get_min_shutter (PdvDev pdv_p)
 Gets the minimum allowable exposure value for this camera, as set by initcam from the camera_config file shutter_speed_min directive. More...
 
int pdv_get_max_shutter (PdvDev pdv_p)
 Gets the maximum allowable exposure value for this camera, as set by initcam from the camera_config file shutter_speed_max directive. More...
 
int pdv_get_min_gain (PdvDev pdv_p)
 Gets the minimum allowable gain value for this camera, as set by initcam from the camera configuration file gain_min directive. More...
 
int pdv_get_max_gain (PdvDev pdv_p)
 Gets the maximum allowable gain value for this camera, as set by initcam from the camera configuration file gain_max directive. More...
 
int pdv_get_min_offset (PdvDev pdv_p)
 Gets the minimum allowable offset (black level) value for this camera, as set by initcam from the camera configuration file offset_min directive. More...
 
int pdv_get_max_offset (PdvDev pdv_p)
 Gets the maximum allowable offset (black level) value for this camera, as set by initcam from the camera configuration file offset_max directive. More...
 
void pdv_set_invert (PdvDev pdv_p, int val)
 Tell the EDT framegrabber hardware to invert each pixel before transferring it to the host computer's memory. More...
 
int pdv_get_invert (PdvDev pdv_p)
 Get the state of the hardware invert register enable bit. See pdv_set_invert for details on this feature. More...
 
void pdv_set_firstpixel_counter (PdvDev pdv_p, int val)
 Enable hardware overwrite of first two bytes of the frame with a counter. More...
 
int pdv_get_firstpixel_counter (PdvDev pdv_p)
 Query state of the hardware first pixel counter register enable bit. See pdv_set_firstpixel_counter() for details on this feature. More...
 
int pdv_set_header_type (PdvDev pdv_p, EdtPdvHeaderType header_type, int irig_offset, int irig_raw)
 Sets the header (or footer) type. More...
 
EdtPdvHeaderType pdv_get_header_type (PdvDev pdv_p)
 Get the header (or footer) type. More...
 
void pdv_set_header_size (PdvDev pdv_p, int header_size)
 Sets the header (or footer) size, in bytes, for the device. More...
 
int pdv_get_header_size (PdvDev pdv_p)
 Returns the currently defined header or footer size. More...
 
void pdv_set_header_position (PdvDev pdv_p, EdtPdvHeaderPosition header_position)
 Sets the header (or footer) position. More...
 
EdtPdvHeaderPosition pdv_get_header_position (PdvDev pdv_p)
 Returns the header or footer position value. More...
 
void pdv_set_header_offset (PdvDev pdv_p, int header_offset)
 Sets the byte offset of the header data in the allocated buffer. More...
 
int pdv_get_header_offset (PdvDev pdv_p)
 Returns the byte offset of the header in the buffer. More...
 
void pdv_set_header_dma (PdvDev pdv_p, bool header_dma)
 Sets the boolean value for whether the image header is included in the DMA from the camera. More...
 
bool pdv_get_header_dma (PdvDev pdv_p)
 Returns the current setting for flag which determines whether the header (or footer) size is to be added to the DMA size. This is true if the camera/device returns header information at the beginning or end of its transfer. More...
 
int pdv_set_image_size (PdvDev pdv_p, int width, int height)
 Sets the width and height of the image. Tells the driver what width and height (in pixels) to expect from the camera. More...
 
int pdv_get_image_size (PdvDev pdv_p)
 Returns the size of the image in bytes, absent any padding or header data. Since padding and header data are usually absent, the value returned from this is usually the same as that returned by pdv_get_imghdr_size(). More...
 
int pdv_get_imghdr_size (PdvDev pdv_p)
 Returns the size of the image buffer in bytes, based on its width, height, and depth. The size returned includes allowance for buffer headers. More...
 
int pdv_get_dma_size (PdvDev pdv_p)
 Returns the actual amount of image data for DMA. More...
 
int pdv_get_cam_width (PdvDev pdv_p)
 Returns the camera image width, in pixels, as set by the configuration file directive width. More...
 
int pdv_get_cam_height (PdvDev pdv_p)
 Returns the camera image height, in pixels, as set by the configuration file directive height, unaffected by changes made by setting a region of interest. See pdv_set_roi() for more information. More...
 
int pdv_check_framesync (PdvDev pdv_p, uint8_t *image_p, uint32_t *framecnt)
 Checks for frame sync and frame count. More...
 
int pdv_enable_framesync (PdvDev pdv_p, int mode)
 Enables frame sync footer and frame out-of-synch detection. More...
 
int pdv_framesync_mode (PdvDev pdv_p)
 Returns the frame sync mode. More...
 
const char * pdv_get_cfgname (PdvDev pdv_p)
 Get the configuration file name. More...
 
void pdv_set_defaults (PdvDev pdv_p)
 Set exposure, gain, and blacklevel to default values. More...
 
void pdv_enable_external_trigger (PdvDev pdv_p, int flag)
 Enables external triggering. More...
 
int pdv_set_frame_period (PdvDev pdv_p, int rate, int method)
 Set the frame period counter and enable/disable frame timing. More...
 
int pdv_get_frame_period (PdvDev pdv_p)
 Get the frame period. More...
 

Detailed Description

Get and set EDT interface board (register) values as well as device driver and camera settings.

Most values get initialized from the config file, via the initcam program or the the camera configuration dialog (see pdv_initcam, initcam.c and the Camera Configuration Guide). In many cases the "get" routines are all that are used from an application, but sometimes it is useful for an application to make changes as well. These subroutines can be used to do both.

Function Documentation

◆ pdv_get_htaps_vtaps()

int pdv_get_htaps_vtaps ( PdvDev  pdv_p,
int *  htaps,
int *  vtaps 
)

Get htaps and vtaps setting values.

Parameters
pdv_pThe open PDV device handle.
[out]htapsOn success, the current horizontal taps value is returned here. Pass NULL to ignore.
[out]vtapsOn success, the current vertical taps value is returned here. Pass NULL to ignore.
Returns
0 on success.

◆ pdv_get_hskip_vskip()

int pdv_get_hskip_vskip ( PdvDev  pdv_p,
int *  hskip,
int *  vskip 
)

Get hskip and vskip setting values.

Parameters
pdv_pThe open PDV device handle.
[out]hskipOn success, the current horizontal skip value is returned here. Pass NULL to ignore.
[out]vskipOn success, the current vertical skip value is returned here. Pass NULL to ignore.
Returns
0 on success.

◆ pdv_get_hactv_vactv()

int pdv_get_hactv_vactv ( PdvDev  pdv_p,
int *  hactv,
int *  vactv 
)

Get hactv and vactv setting values.

Parameters
pdv_pThe open PDV device handle.
[out]hactvOn success, the current horizontal active pixels value is returned here. Pass NULL to ignore.
[out]vactvOn success, the current vertical active pixels value is returned here. Pass NULL to ignore.
Returns
0 on success.

◆ pdv_get_fv_once()

int pdv_get_fv_once ( PdvDev  pdv_p)

Get value of fv_once (frame valid once) flag.

pdv_p The open PDV device handle.

Returns
1 if fv_once is true, 0 if false or on error.

◆ pdv_set_full_bayer_parameters()

void pdv_set_full_bayer_parameters ( int  nSourceDepth,
double  scale[3],
double  gamma,
int  nBlackOffset,
int  bRedRowFirst,
int  bGreenPixelFirst,
int  quality,
int  bias,
int  gradientcolor 
)

Sets the full bayer parameters for images for PCI DV library decoding of bayer formatted color image data. Bayer decoding by the library is typically enabled by setting the config file directive method_interlace to BGGR or BGGR_WORD; this subroutine can be used to manipulate the specific Bayer decoding parameters. Images captured with pdv_image, pdv_wait_images or othe PCI DV library acquisition routines (excepting _raw routines) will be preprocessed to RGB color before the image pointer is returned.

The bRedRowFirst and bGreenPixelFirst parameters are typically initialized by the kbs_red_row_first and kbs_green_pixel_first configuration file directives. Current values can be found in the PdvDev dd_p->kbs_green_pixel_first and dd_p->kbs_dd_p->red_row_first structure elements.

The most common operation for pdv_set_full_bayer_parameters is adjusting the white balance. To do so, the calling application should provide a method for acquiring an image of a white background, calculate the average of all pixels in each of the R, G and B components, then set scale[0] (green) to 1.0, and adjust scale[1-2] (red/blue) such that red and blue will be scaled appropriately.

Note that the Bayer decoding functionality uses MMX instructions when run under the Windows environment, providing greater efficiency and more algorithm (quality) options. Only one algorithm is defined in the Linux/Unix implementation so the quality parameter will be ignored on those platforms.

Parameters
nSourceDepthdepth in bits of source (unfiltered) data
scalearray of 3 values (R,G,B) for scaling (gain); default 1.0, 1.0, 1.0
gammagamma value – default 1.0
nBlackOffsetBlack Offset (black level); 1 is default
bRedRowFirst1 if red/green row is first on the sensor, 0 if blue/green is first
bGreenPixelFirst1 if green pixel is first on sensor, 0 if red or blue
qualityselects one of 3 Bayer decoding algorithms: 0=Bilinear, 1=Gradient, 2=Bias-corrected – MS Windows only. Note that in Linux/Unix, only Bilinear is implemented and this parameter is ignored
biasselects the bias for bias method Bayer algorithm; (MS Windows only)
gradientcolorselects the gradient for the gradient Bayer algorithm (MS Windows only)
See also
method_interlace, kbs_red_row_first, kbs_green_pixel_first camera configuration directives – see the Camera configuration guide

◆ pdv_get_camera_type()

const char * pdv_get_camera_type ( PdvDev  pdv_p)

Gets the type of the camera, as set by initcam from the camera configuration file's camera description directives. This is a concatenation of camera_class, camera_model, and camera_info, directives.

Note
the camera class, model and info are for information only, and are not used by the driver or library. They are intended for use by applications to allow the user to browse and select a specific camera configuration.
Parameters
pdv_pThe open PDV device handle.
Returns
A string representing the camera type.
See also
pdv_get_camera_class(), pdv_get_camera_model(), pdv_get_camera_info(), camera_class, camera_model, camera_info directives in the Camera Configuration Guide

◆ pdv_get_camera_class()

const char * pdv_get_camera_class ( PdvDev  pdv_p)

Gets the class of the camera (usually the manufacturer name), as set by initcam from the camera_config file camera_class directive.

Note
the camera class, model and info are for information only, and are not used by the driver or library. They are intended for use by applications to allow the user to browse and select a specific camera configuration.
Parameters
pdv_pThe open PDV device handle.
Returns
A string representing the camera class.
See also
pdv_get_camera_type(), camera_class directive in the Camera Configuration Guide

◆ pdv_get_camera_model()

const char * pdv_get_camera_model ( PdvDev  pdv_p)

Gets the model of the camera, as set by initcam from the camera_config file camera_model directive.

Parameters
pdv_pThe open PDV device handle.
Returns
A string representing the camera model.
See also
camera_model directive in the Camera Configuration Guide

◆ pdv_get_camera_info()

const char * pdv_get_camera_info ( PdvDev  pdv_p)

Gets the string set by the camera_info configuration file directive.

See pdv_get_camera_type() for more information on camera strings.

Parameters
pdv_pThe open PDV device handle.
Returns
A string representing the camera info.
See also
camera_info directive in the Camera Configuration Guide

◆ pdv_set_width()

int pdv_set_width ( PdvDev  pdv_p,
int  value 
)

Sets width and reallocates buffers accordingly.

Since we rarely ever set width and not height, you should normally just use pdv_set_image_size() to set both.

Parameters
pdv_pThe open PDV device handle.
valueThe new width in pixels.
Returns
0 on success, -1 on error.

◆ pdv_get_width()

int pdv_get_width ( PdvDev  pdv_p)

Gets the width of the image (number of pixels per line), based on the camera in use.

If the width has been changed by setting a region of interest, the modified values are returned; use pdv_get_cam_width() to get the unchanged width.

Parameters
pdv_pThe open PDV device handle.
Returns
The width in pixels of images returned from an aquire.
See also
pdv_get_cam_width(), width directive in the Camera Configuration Guide.

◆ pdv_get_pitch()

int pdv_get_pitch ( PdvDev  pdv_p)

Gets the number of bytes per line.

The result will be different than pdv_get_width() if the pixel depth is not 8 bits.

Parameters
pdv_pThe open PDV device handle.
Returns
The pitch in bytes of images returned from an aquire.

◆ pdv_set_height()

int pdv_set_height ( PdvDev  pdv_p,
int  value 
)

Sets height and reallocates buffers accordingly.

Since we rarely ever set height and not width, you should normally just use pdv_set_image_size() to set both.

Parameters
pdv_pThe open PDV device handle.
valueThe new height in pixels.
Returns
0 on success, -1 on failure.

◆ pdv_get_height()

int pdv_get_height ( PdvDev  pdv_p)

Gets the height of the image (number of lines), based on the camera in use.

If the height has been changed by setting a region of interest, the modified values are returned; use pdv_get_cam_height() to get the unchanged height.

Parameters
pdv_pThe open PDV device handle.
Returns
The height in pixels of images returned from an acquire.
See also
pdv_get_cam_height(), height directive in the Camera Configuration Guide.

◆ pdv_get_frame_height()

int pdv_get_frame_height ( PdvDev  pdv_p)

Gets the height of a single image when the system is configured for multiple images per buffer.

Unless the frame_height directive is specified in the config file this will return zero.

This setting is useful in some cases where special handling of image data by an application is used such as multiple frames per image.

Parameters
pdv_pThe open PDV device handle.
Returns
The height of a single image frame in pixels.
See also
pdv_get_height(), pdv_get_cam_height()

◆ pdv_set_depth_extdepth_dpath()

int pdv_set_depth_extdepth_dpath ( PdvDev  pdv_p,
int  depth,
int  extdepth,
unsigned int  dpath 
)

Sets the bit depth, extended depth, and camera link data path.

Parameters
pdv_pThe open PDV device handle.
depthThe new depth value.
extdepthThe new extended depth value.
dpathThe new camera link data path value. Passing zero (0) will cause an appropriate value to be calculated automatically.
Returns
0 on success
See also
pdv_cl_set_base_channels(), pdv_get_depth(), pdv_get_extdepth(), depth, extdepth, CL_DATA_PATH_NORM directives in the Camera Configuration Guide

The bit depth is the number of valid bits per pixel that the board will transfer across the bus. Normally depth is initialized during initcam via the configuration file depth directive, and the only time this subroutine should be needed is if the depth changes, via a post-initialization command to the camera for example.

Extended depth, extdepth, is usally the same but not always. If they are different, the actual number of bits per pixel passed through by the EDT framegrabber board will be different from that received from the camera. For example, if extdepth is 10 (matching a camera output of 10 bits) but depth is 8, the board will only pass one byte per pixel, even though the camera is outputting two bytes per pixel. There are also special cases including 24-bit depth / 8-bit extdepth (Bayer), and 10-bit depth / 80-bit extdepth (8-tap, 10-bit packed).

This subroutine also allows you to set the camera link data path register for the specific number of taps and bits per pixel. Specific value (hex) is as follows:

  • Left (MS) nibble: number of taps minus 1
  • Right (LS) nibble: number of bits per pixel minus 1

For example for a 2-tap, 8-bit camera, dpath should be 0x17.

The correct data path value can usually be inferred automatically from the depth. If you specify a dpath value of 0, pdv_set_depth_extdepth_dpath will automatically set the register to the most likely value.

Normally depth, extended depth and dpath are initialized during initcam via the configuration file depth and extdepth and CL_DATA_PATH_NORM directives. Therefore, the only time this subroutine should be needed is if the depth changes, for example via a post-initialization command to the camera.

◆ pdv_get_depth()

int pdv_get_depth ( PdvDev  pdv_p)

Gets the depth of the image (number of bits per pixel), as set in the configuration file for the camera in use.

Parameters
pdv_pThe open PDV device handle.
Returns
The number of bits per pixel in the image.
See also
pdv_set_depth_extdepth_dpath(), pdv_get_extdepth(), depth directive in the Camera Configuration Guide.

◆ pdv_get_extdepth()

int pdv_get_extdepth ( PdvDev  pdv_p)

Gets the extended depth of the camera.

The extended depth is the number of valid bits per pixel that the camera outputs, as set by initcam from the configuration file edtdepth directive. Note that if depth is set differently than extdepth, the actual number of bits per pixel passed through by the EDT framegrabber board will be different. For example, if extdepth is 10 but depth is 8, the board will only transfer one byte per pixel, even though the camera is outputting two bytes per pixel.

Parameters
pdv_pThe open PDV device handle.
Returns
The extended depth.
See also
pdv_get_depth(), extdepth directive in the Camera Configuration Guide.

◆ pdv_cl_set_base_channels()

void pdv_cl_set_base_channels ( PdvDev  pdv_p,
int  htaps,
int  vtaps 
)

Set the number of channels (taps) and horizontal and vertical alignment of the taps.

Parameters
pdv_pThe open PDV device handle.
htapsThe number of horizontal taps.
vtapsThe number of vertical taps.
See also
pdv_set_depth_extdepth_dpath(), hskip, vskip and CL_DATA_PATH_NORM directives in the Camera Configuration Guide.

Will set the number of Camera Link taps (channels) in the hardware by setting the left nibble of the PDV_CL_DATA_PATH register, and the htaps and vtaps PdvDev->dd_p structure elements.

For single-tap modes, htaps and vtaps should both be 1. For dual or 4-tap modes, most cameras output the data horizontally so htaps would be 2 or 4, and vtaps would remain 1. For RGB cameras (except bayer), htaps is usually 3 and vtaps 1.

Typically these are set via initcam or pdv_initcam; look at the various config files' htaps and vtaps directives. If a camera's output tap configuration is changed after after initialization, (usually via a serial command) this command can be used to update the framegrabber's registers to match.

◆ pdv_set_shutter_method()

int pdv_set_shutter_method ( PdvDev  pdv_p,
int  method,
unsigned int  mcl 
)

Set the device's exposure method and CC line state.

Parameters
pdv_pThe open PDV device handle.
methodThe exposure method.
mclThe mode control (CC line) state.
Returns
0 on success, -1 on failure.
See also
pdv_get_shutter_method()

Typically the exposure method is set in the config file via the method_camera_shutter_timing and MODE_CNTL_NORM directives. This subroutine provides a programatic way to do the same thing, post-configuration.

The most common values for method (defined in pdv_dependent.h) are:

  • AIA_SERIAL: Default. Expose timing is controlled via serial or other (camera-dependent) method and the board's hardware is not involved in timing the shutter.
  • AIA_MCL: CC pulse-width timing, millisecond granularity. Each image capture request (e.g. pdv_start_images()) will cause the board to set the EXPOSE (CC) line or lines (as set via the mcl parameter's left nibble) TRUE for the current expose time in milliseconds, as set by pdv_set_exposure().
  • AIA_MCL_100US: CC pulse-width timing, 100 microsecond granularity. Each image capture request (e.g. pdv_start_images()) will cause the board to set the EXPOSE (CC) line or lines (as set via the mcl parameter's left nibble) TRUE for the current expose time in 100 microsecond increments, as set by pdv_set_exposure().

Several other methods are defined, but most are specific to legacy AIA cameras / framegrabbers and are not applicable to Camera Link. For more information on all available methods see the Camera Configuration Guide.

The mcl parameter sets the state of the four camera control (CC) lines, as an 8-bit hexidecimal number. The right nibble sets the steady state of the CC lines, and the left nibble selects which of these lines, if any, the framegrabber hardware use to send out a trigger or expose pulse on each capture request. Most commonly, this value will be 0x00 when the camera generates images continuously or is triggered via an external source, or 0x10 if the board should send out a trigger pulse (1 millisecond, if method equals AIA_SERIAL) or timed pulse (as set via pdv_set_exposure() if method equals AIA_MCL or AIA_MCL_100US) on the CC1 line on each image capture request. See the the Camera Configuration Guide for information on the less common values.

Note
The AIA Camera Link specification doesn't define how the four CC lines should be used, if at all. However in our experience, virtually all Camera Link cameras that have CC-driven trigger or expose modes use CC1, which corresponds to an mcl value of 0x10. For more details see your camera's documentation, and the description of 0x07 Mode Control register in the Firmware Guide for Camera Link.

◆ pdv_get_shutter_method()

int pdv_get_shutter_method ( PdvDev  pdv_p,
unsigned int *  mcl 
)

Returns the shutter (expose) timing method and mode control (CC) state.

See pdv_set_shutter_method for an explanation of the return value (shutter method) and mcl parameter;

Parameters
pdv_pThe open PDV device handle.
[out]mclReturns mode control (CC line) state. Pass NULL to skip reading the current state.
Returns
The shutter (expose) timing method.
See also
pdv_set_shutter_method()

◆ pdv_get_interlace_method()

int pdv_get_interlace_method ( PdvDev  pdv_p)

Returns the interleave method, as set from the method_interlace directive in the configuration file (from pdv_initcam()). This method is used to determine how the image data will be rearranged (if at all) before being returned from pdv_wait_images() or pdv_read().

Parameters
pdv_pThe open PDV device handle.
Returns
The interleave method.
See also
method_interlace directive in the Camera Configuration Guide.

For more on deinterleave methods, see the Camera Configuration Guide.

Note
the _raw acquisition routines bypass the deinterleave logic.

The available interleave methods, as defined in pdv_dependent.h, are

  • PDV_BGGR 8-bit Bayer encoded data
  • PDV_BGGR_DUAL 8-bit Bayer encoded data, from dual channel camera
  • PDV_BGGR_WORD 10-12 bit Bayer encoded data
  • PDV_BYTE_INTLV Data is byte interleaved (odd/even pixels are from odd/even lines, 8 bits per pixel).
  • PDV_WORD_INTLV Data is word interleaved (odd/even pixels are from odd/even lines, 16 bits per pixel).
  • DALSA_2CH_INTLV Byte data per 2 channel dalsa "A" model sensor format – see Dalsa D4/D7 camera manual
  • DALSA_4CH_INTLV Byte data with 4 channel Dalsa formatting – see Dalsa D4/D7 camera manual
  • EVEN_RIGHT_INTLV 8-bit data, pixels in pairs with 1st pixel from left half, 2nd pixel from right half of screen
  • PDV_FIELD_INTLC Data is byte interleaved (odd/even pixels are from odd/even lines,
  • PDV_FIELD_INTLC Data is field interlaced (odd/even lines are from top/bottom half of image).
  • PDV_ILLUNIS_BGGR BBGR for Illunis cameras (?)
  • PDV_ILLUNIS_INTLV Byte interleave from Illunis cameras (?)
  • PDV_INVERT_RIGHT_INTLV Byte data, even pixels are right half, inverted
  • PDV_PIRANHA_4CH_INTLV Piranha 4 channel line scan format (see Dalsa Piranha camera manual)
  • PDV_SPECINST_4PORT_INTLV Spectral instruments format (see Spectral Instruments camera manual)
  • PDV_WORD_INTLV Deinterlaced, word format
  • PDV_WORD_INTLV_HILO Deinterlaced, 2-bytes per pixel, even first
  • PDV_WORD_INTLV_ODD Deinterlaced, 2-bytes per pixel, odd first

◆ pdv_set_exposure()

int pdv_set_exposure ( PdvDev  pdv_p,
int  value 
)

Sets the exposure time, using the method defined by the directives in the camera configuration file, if set.

Parameters
pdv_pThe open PDV device handle.
valueThe exposure time. For AIA_MCL or AIA_MCL_100US, the valid range is 0-25500. For other methods, valid range and increments are camera-dependent.
Returns
0 if successful, -1 if unsuccessful.
See also
pdv_set_shutter_method(), pdv_get_shutter_method(), MODE_CNTL_NORM, serial_exposure and method_camera_shutter_timing directives in the Camera Configuration Guide.

pdv_set_exposure will set the exposure (or not) on the camera depending on how the related directives are set in the camera configuration file. Specifically, the method_camera_shutter_timing directive (or pdv_set_shutter_method()) defines whether timing is to be controlled via camera serial commands, or by the board via Camera Control (CC) lines.

If method_camera_shutter_timing is AIA_MCL or AIA_MCL_100US and something other than 0 is in the left nibble of MODE_CNTL_NORM, the board will use its internal shutter timer and send out an expose pulse on the specified CC line with a TRUE period of the number in milliseconds (AIA_MCL) or tenths of milliseconds (AIA_MCL_100US) specified by the value parameter. The valid range in either case is 0-25500.

If method_camera_shutter_timing is AIA_SERIAL (the default), and then this subroutine sends the appropriate serial commands based on the method_serial_format directive, which defines which serial format is to be used. The default format is SERIAL_ASCII, in which case the subroutine will set the exposure by sending the command specified by the serial_exposure directive, if present. If method_serial_format is SERIAL_ASCII but there is no serial_exposure directive, this subroutine is a no-op.

In the case of method_serial_format: SERIAL_ASCII or any other serial mode, the range is camera dependent. Other methods are available that are specific to specific cameras – see the Camera Configuration guide for details.

Warning
Using this subroutine for other than AIA_MCL or AIA_100US camera shutter timing modes (that is, any method that uses serial) is no longer recommended. Back in the AIA (pre-Camera Link) days, there was a manageable set of serial methods, so it made sense to have one subroutine that could control exposure time for all the available methods. But the sheer number of different schemes has outgrown this library's ability to keep up, so for any camera command sets other than those that use straight ASCII serial with an integer argument, it's more reliable to instead send any camera-specific serial commands using pdv_serial_command(), pdv_serial_binary_command(), or pdv_serial_write().

◆ pdv_get_exposure()

int pdv_get_exposure ( PdvDev  pdv_p)

Gets the exposure time on the digital imaging device.

Applies only when using board-controlled shutter timing for which shutter timing methods have been programmed into the library. The valid range is camera-dependent.

Parameters
pdv_pThe open PDV device handle.
Returns
Exposure time, in milliseconds.
See also
pdv_set_exposure(), method_camera_shutter_timing directive in the Camera Configuration Guide.

◆ pdv_set_gain()

int pdv_set_gain ( PdvDev  pdv_p,
int  value 
)

Sets the gain on the input device.

Applies only to cameras for which extended control capabilities have been added to the library, or that have a serial command protocol that has been configured using the serial_gain configuration directive. Unless you know that one of the above has been implemented for your camera, it is usually safest to just send the specific serial commands via pdv_serial_command() or pdv_serial_write().

The valid range is -128 to 128. The actual range is camera-dependent.

Parameters
pdv_pThe open PDV device handle.
valueThe gain setting.
Returns
0 on success, -1 on failure.
See also
pdv_get_gain(), seriial_gain directive in the Camera Configuration Guide.

◆ pdv_get_gain()

int pdv_get_gain ( PdvDev  pdv_p)

Gets the gain on the device.

Applies only to cameras for which extended control capabilities have been written into the library, such as the Kodak Megaplus i series.

Parameters
pdv_pThe open PDV device handle.
Returns
The gain value.
See also
pdv_set_gain(), seriial_gain directive in the Camera Configuration Guide.

◆ pdv_set_blacklevel()

int pdv_set_blacklevel ( PdvDev  pdv_p,
int  value 
)

Sets the black level (offset) on the input device.

Applies only to cameras for which extended control capabilities have been added to the library (see the source code), or that have a serial command protocol that has been configured using the serial_offset configuration directive. Unless you know that one of the above has been implemented for your camera, it is usually safest to just send the specific serial commands via pdv_serial_command() or pdv_serial_write().

Parameters
pdv_pThe open PDV device handle.
valueThe black level value. The valid range is camera-dependent.
Returns
0 on success, -1 on failure.
See also
pdv_get_blacklevel(), serial_offset directive in the Camera Configuration Guide.

◆ pdv_get_blacklevel()

int pdv_get_blacklevel ( PdvDev  pdv_p)

Gets the black level (offset) on the imaging device.

Applies only to cameras for which extended control capabilities have been written into the library, such as the Kodak Megaplus i series.

Parameters
pdv_pThe open PDV device handle.
Returns
The black level value.

◆ pdv_set_binning()

int pdv_set_binning ( PdvDev  pdv_p,
int  xval,
int  yval 
)

Set binning on the camera to the specified values, and recalculate the values that will be returned by pdv_get_width(), pdv_get_height(), and pdv_get_image_size().

Parameters
pdv_pThe open PDV device handle.
xvalThe x binning value. Usually 1, 2, 4 or 8. Default is 1.
yvalThe y binning value. Usually 1, 2, 4 or 8. Default is 1.
Returns
0 on success, -1 on failure.
See also
serial_binning directive in the Camera Configuration Guide.

Only applicable to cameras for which binning logic has been implemented in the library – specifically DVC cameras that use the BIN xval yval, Atmel cameras that use B= val (where val= 0, 1 or 2), or in conjunction with the serial_binning camera configuration directive for any camera that uses an ASCII CMD VALUE pair to set binning.

This subroutine was an attempt to provide a way to set binning in a generic way, handling a few specific cameras via special code and others using an assumed serial format. As it turned out, the "assumed" format is not all that standard, therefore this subroutine is of limited usefulness.

If your camera is one that takes a single ASCII command / argument to set a binning mode, then this subroutine may still be handy since it can be a single- call method for setting the camera and the board in a given binning mode.

To use this method, simply set the serial_binning camera configuration directive to the command that sets binning. Then when called, this subroutine will send the command and reset the board's camera size.

If your camera does not fit any of the above formats (or if you would rather not depend on this logic), simply use pdv_serial_command() or pdv_serial_binary_command() to send the command to put the camera into binned mode, then call pdv_set_image_size() to reset the board to the new frame size.

If the PDV library does not know how to set binning on the camera in use, a -1 will be returned and the width/height/imagesize will remain unchanged.

◆ pdv_set_start_delay()

void pdv_set_start_delay ( PdvDev  pdv_p,
int  delay_ms 
)

Set the time to wait between acquiring images.

Parameters
pdv_pThe open PDV device handle.
delay_msThe delay in milliseconds.

◆ pdv_get_start_delay()

int pdv_get_start_delay ( PdvDev  pdv_p)

Get the time to wait between acquiring images.

Parameters
pdv_pThe open PDV device handle.
Returns
The delay in milliseconds.

◆ pdv_enable_roi()

int pdv_enable_roi ( PdvDev  pdv_p,
int  flag 
)

Enables on-board region of interest.

Parameters
pdv_pThe open PDV device handle.
flagNonzero to enable region of interest; 0 to disable it.
Returns
0 on success, -1 on failure.
See also
pdv_set_roi() for an example.

The rectangular region of interest parameters are set using pdv_set_roi(); this subroutine is used to enable/disable that region. Also calls pdv_set_image_size() so subsequent calls to pdv_get_width() or pdv_get_height() return the values afterthe region of interest is applied. Also resizes and reallocates any buffers allocated as a result of calling pdv_multibuf(). Returns an error if the region of interest values are out of range.

The initial state of the region of interest can be controlled with directives in the configuration file. Most config files provided by EDT have ROI enabled by default. See the Camera Configuration Guide for more information.

◆ pdv_get_roi_enabled()

int pdv_get_roi_enabled ( PdvDev  pdv_p)

Read if region of interest (ROI) is enabled.

Parameters
pdv_pThe open PDV device handle.
Returns
Nonzero if the region of interest is enabled.

◆ pdv_set_roi()

int pdv_set_roi ( PdvDev  pdv_p,
int  hskip,
int  hactv,
int  vskip,
int  vactv 
)

Sets a rectangular region of interest, supporting cropping.

Parameters
pdv_pThe open PDV device handle.
hskipThe X coordinate of the upper left corner of the region of interest.
hactvThe width (number of pixels per line) of the region of interest.
vskipThe Y coordinate of the upper left corner of the region of interest.
vactvThe height (number of lines per frame) of the region of interest.
Returns
0 on success, -1 on failure.
See also
pdv_enable_roi(), vskip, vactv, hskip, hactv directives in the Camera Configuration Guide.

Sets the coordinates of a rectangular region of interest within the image. Checks the camera width and height directives in the configuration file and returns an error if the coordinates provided are out of range. Use this with pdv_enable_roi(), which enables the region of interest.

Note that hactv + hskip should always be less than or equal to the actual output width of the camera, and vact + vskip should be less than or equal to the number of output lines.

An initial region of interest can be set from the config file with the hactv, hskip, vactv, and vskip directives.

Note
Region of Interest may not work with some very old cameras which required special bitfiles. It will work with most DV, DVK, and all Camera Link boards.

Example:

//use the region of interest calls to cut off a 10 pixel wide
//border around the image.
int cam_w = pdv_get_cam_width(pdv_p);
int cam_h = pdv_get_cam_height(pdv_p);
int hactv = cam_w - 20
int vactv = cam_h - 20
int hskip = 10;
int vskip = 10;
pdv_set_roi(pdv_p, hskip, hactv, vskip, vactv);
pdv_enable_roi(pdv_p, 1);

◆ pdv_auto_set_roi()

int pdv_auto_set_roi ( PdvDev  pdv_p)

Set ROI to camera width/height; adjust ROI width to be a multiple of 4, and enable ROI.

Parameters
pdv_pThe open PDV device handle.
Returns
0 on success, -1 on failure.

◆ pdv_set_cam_width()

int pdv_set_cam_width ( PdvDev  pdv_p,
int  value 
)

Sets placeholder for original full camera frame width, unaffected by ROI changes and usually only called by pdv_initcam.

Parameters
pdv_pThe open PDV device handle.
valueThe width of the camera's sensor in pixels.
Returns
0 on success, -1 on failure.

Not to be confused with pdv_set_width(); this subroutine sets the pdv_p->dd_p->cam_width value, which only exists as a place to record the camera's (presumably) full width, normally set by the config file 'width' directive and unaffected by any subsequent region of interest or pdv_set_image_size changes. Generally only useful to provide a hint to applications a way to change that value, though it normally only gets called by pdv_initcam. Doesn't change the buffer sizes or region of interest – for that, use pdv_set_roi() or pdv_set_image_size().

◆ pdv_set_cam_height()

int pdv_set_cam_height ( PdvDev  pdv_p,
int  value 
)

Sets placeholder for original full camera frame height, unaffected by ROI changes and usually only called by pdv_initcam.

Parameters
pdv_pThe open PDV device handle.
valueThe height of the camera's sensor in pixels.
Returns
0 on success, -1 on failure.

Not to be confused with pdv_set_height; this subroutine sets the pdv_p->dd_p->cam_height value, which only exists as a place to record the camera's (presumably) full height, normally set by the config file 'height' directive and unaffected by any subsequent region of interest or pdv_set_image_size changes. This subroutine is just here to give applications a way to change that value, though it normally only gets called by pdv_initcam. Doesn't change the buffer sizes or region of interest – for that, use pdv_set_roi or pdv_set_image_size.

◆ pdv_get_min_shutter()

int pdv_get_min_shutter ( PdvDev  pdv_p)

Gets the minimum allowable exposure value for this camera, as set by initcam from the camera_config file shutter_speed_min directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The minimum exposure value.
See also
shutter_speed_min directive in the Camera Configuration Guide.

◆ pdv_get_max_shutter()

int pdv_get_max_shutter ( PdvDev  pdv_p)

Gets the maximum allowable exposure value for this camera, as set by initcam from the camera_config file shutter_speed_max directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The maximum exposure value.
See also
shutter_speed_max directive in the Camera Configuration Guide.

◆ pdv_get_min_gain()

int pdv_get_min_gain ( PdvDev  pdv_p)

Gets the minimum allowable gain value for this camera, as set by initcam from the camera configuration file gain_min directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The minimum gain value.
See also
gain_min directive in the Camera Configuration Guide.

◆ pdv_get_max_gain()

int pdv_get_max_gain ( PdvDev  pdv_p)

Gets the maximum allowable gain value for this camera, as set by initcam from the camera configuration file gain_max directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The maximum gain value.
See also
gain_max directive in the Camera Configuration Guide.

◆ pdv_get_min_offset()

int pdv_get_min_offset ( PdvDev  pdv_p)

Gets the minimum allowable offset (black level) value for this camera, as set by initcam from the camera configuration file offset_min directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The minimum offset value.
See also
offset_min directive in the Camera Configuration Guide.

◆ pdv_get_max_offset()

int pdv_get_max_offset ( PdvDev  pdv_p)

Gets the maximum allowable offset (black level) value for this camera, as set by initcam from the camera configuration file offset_max directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The maximum offset value.
See also
offset_max directive in the Camera Configuration Guide.

◆ pdv_set_invert()

void pdv_set_invert ( PdvDev  pdv_p,
int  val 
)

Tell the EDT framegrabber hardware to invert each pixel before transferring it to the host computer's memory.

This is implemented in firmware and has no impact on performance.

Parameters
pdv_pThe open PDV device handle.
valNonzero to enable invert mode; 0 to disable it.

◆ pdv_get_invert()

int pdv_get_invert ( PdvDev  pdv_p)

Get the state of the hardware invert register enable bit. See pdv_set_invert for details on this feature.

Parameters
pdv_pThe open PDV device handle.
Returns
Nonzero if invert mode is enabled.

◆ pdv_set_firstpixel_counter()

void pdv_set_firstpixel_counter ( PdvDev  pdv_p,
int  val 
)

Enable hardware overwrite of first two bytes of the frame with a counter.

The counter increments by one for every frame received by the framegrabber. Disabling this also resets the counter to zero, unless framesync mode is also enabled (see pdv_enable_framesync()).

Parameters
pdv_pThe open PDV device handle.
valNonzero to enable the counter; 0 to disable it.

◆ pdv_get_firstpixel_counter()

int pdv_get_firstpixel_counter ( PdvDev  pdv_p)

Query state of the hardware first pixel counter register enable bit. See pdv_set_firstpixel_counter() for details on this feature.

Parameters
pdv_pThe open PDV device handle.
Returns
Nonzero if the counter is enabled.

◆ pdv_set_header_type()

int pdv_set_header_type ( PdvDev  pdv_p,
EdtPdvHeaderType  header_type,
int  irig_offset,
int  irig_raw 
)

Sets the header (or footer) type.

Parameters
pdv_pThe open PDV device handle.
header_typeHeader type, from the edt_pdv_header_type enum.
irig_offsetTimecode offset in seconds. Typically set to 2 seconds. Ignored if header_type is PDV_HDR_TYPE_NONE.
irig_raw0 = Enable UNIX timecode format. 1 = Enable raw timecode format. Ignored if header_type is PDV_HDR_TYPE_NONE.
Returns
0 in success, -1 on failure.
See also
pdv_set_header_size(), method_header_type directive in the Camera Configuration Guide, and the Timestamp appendix in the User's Guide.

Enables header (or footer) functionality including position, size, DMA, and associated registers for tagging data with magic number, count, and timestamp data.

Currently only one type, PDV_HDR_TYPE_IRIG2 is defined. For more about the IRIG functionality of EDT frame grabbers, see the Timestamping appendix in the VisionLink F-series user guide.

This subroutine and the associated camera config directive method_header_type encapsulate setting the header logic for a specific method in a single operation. Header functionality can also be implemented by setting the header directives directly, via pdv_set_header_size(), pdv_set_header_dma(), pdv_set_header_offset(), etc.

The subroutine will return a fail code if the EDT device is one that does not support this feature.

header type may be alternately set at init time via the configuration file directive method_header_type: IRIG2

◆ pdv_get_header_type()

EdtPdvHeaderType pdv_get_header_type ( PdvDev  pdv_p)

Get the header (or footer) type.

Parameters
pdv_pThe open PDV device handle.
Returns
The header type as an edt_pdv_header_type enum.
See also
pdv_set_header_type(), method_header_type directive in the Camera Configuration Guide.

◆ pdv_set_header_size()

void pdv_set_header_size ( PdvDev  pdv_p,
int  header_size 
)

Sets the header (or footer) size, in bytes, for the device.

This can also be done by using the header_size directive in the camera configuration file.

Parameters
pdv_pThe open PDV device handle.
header_sizeThe new header size in bytes.
See also
pdv_get_header_size(), header_size directive in the Camera Configuration Guide.

◆ pdv_get_header_size()

int pdv_get_header_size ( PdvDev  pdv_p)

Returns the currently defined header or footer size.

This is usually set in the configuration file with the directive header_size. It can also be set by calling pdv_set_header_size().

Parameters
pdv_pThe open PDV device handle.
Returns
Current header size.
See also
pdv_set_header_size(), header_size directive in the Camera Configuration Guide.

◆ pdv_set_header_position()

void pdv_set_header_position ( PdvDev  pdv_p,
EdtPdvHeaderPosition  header_position 
)

Sets the header (or footer) position.

Parameters
pdv_pThe open PDV device handle.
header_positionThe starting point for the header.
See also
pdv_get_header_offset(), pdv_set_header_offset(), EdtPdvHeaderPosition.

◆ pdv_get_header_position()

EdtPdvHeaderPosition pdv_get_header_position ( PdvDev  pdv_p)

Returns the header or footer position value.

These values can be set in the configuration file with the method_header_position directive.

Parameters
pdv_pThe open PDV device handle.
Returns
The header position.
See also
pdv_get_header_offset(), method_header_position directive in the Camera Configuration Guide.

◆ pdv_set_header_offset()

void pdv_set_header_offset ( PdvDev  pdv_p,
int  header_offset 
)

Sets the byte offset of the header data in the allocated buffer.

Parameters
pdv_pThe open PDV device handle.
header_offsetThe header offset.

◆ pdv_get_header_offset()

int pdv_get_header_offset ( PdvDev  pdv_p)

Returns the byte offset of the header in the buffer.

The byte offset is determined by the header position value. If header_position is PDV_HEADER_BEFORE, the offset is 0; if header_position is PDV_HEADER_AFTER (i.e. not really a header but a footer), the offset is the image size. If header_position is PDV_HEADER_MIDDLE, the header offset can be set using the header_offset directive in the camera_configuration file, or by calling pdv_set_header_offset().

Parameters
pdv_pThe open PDV device handle.
Returns
A byte offset from the beginning of the buffer.
See also
pdv_get_header_position(), pdv_set_header_offset()

◆ pdv_set_header_dma()

void pdv_set_header_dma ( PdvDev  pdv_p,
bool  header_dma 
)

Sets the boolean value for whether the image header is included in the DMA from the camera.

Parameters
pdv_pThe open PDV device handle.
header_dmaTrue to include the header, false if not.
See also
pdv_get_header_dma()

◆ pdv_get_header_dma()

bool pdv_get_header_dma ( PdvDev  pdv_p)

Returns the current setting for flag which determines whether the header (or footer) size is to be added to the DMA size. This is true if the camera/device returns header information at the beginning or end of its transfer.

Parameters
pdv_pThe open PDV device handle.
Returns
True if header is included in DMA size.

◆ pdv_set_image_size()

int pdv_set_image_size ( PdvDev  pdv_p,
int  width,
int  height 
)

Sets the width and height of the image. Tells the driver what width and height (in pixels) to expect from the camera.

This call is ordinarily unnecessary in an application program, because the width and height are set automatically when initcam runs. Exceptions can occur, however; for example, if the camera's output size can be changed while running, or if the application performs setup that supersedes initcam. This routine is provided for these special cases.

Parameters
pdv_pThe open PDV device handle.
widthThe width of the image in pixels.
heightThe height of the image in pixels.
Returns
0 on success, -1 on failure.

◆ pdv_get_image_size()

int pdv_get_image_size ( PdvDev  pdv_p)

Returns the size of the image in bytes, absent any padding or header data. Since padding and header data are usually absent, the value returned from this is usually the same as that returned by pdv_get_imghdr_size().

Parameters
pdv_pThe open PDV device handle.
Returns
The image size, in bytes.
See also
pdv_get_imghdr_size()

◆ pdv_get_imghdr_size()

int pdv_get_imghdr_size ( PdvDev  pdv_p)

Returns the size of the image buffer in bytes, based on its width, height, and depth. The size returned includes allowance for buffer headers.

Enabling a region of interest changes this value. To obtain the actual size of the image data without any optional header or other padding, see pdv_get_dma_size().

Parameters
pdv_pThe open PDV device handle.
Returns
The total number of bytes in the image, including buffer header overhead.
See also
pdv_set_roi()

◆ pdv_get_dma_size()

int pdv_get_dma_size ( PdvDev  pdv_p)

Returns the actual amount of image data for DMA.

Parameters
pdv_pThe open PDV device handle.
Returns
The DMA size in bytes.
See also
pdv_get_imghdr_size(), pdv_get_header_position(), pdv_extra_headersize().

Normally DMA is the same as the size of the sensor output (width x height x depth in bytes), so for example a 1K x 1K 8 bits per pixel camera would be 1024x1024x1 = 1048576 bytes, and a 1K x 1K 10 bits per pixel camera would be 1024x1024x2 = 2097152. However it can be different from the sensor output in a number of cases:

  • If DMA header data is enabled (for IRIGB timestamp input for example), dmasize will be imagesize plus the size of the header.
  • If the sensor is a bayer or other interpolated image with one of the interleave options enabled (via the method_interlace: BGGR_WORD directive in the config file for example), imagesize will be at least 3x dmasize.
  • If the data is packed (e.g. 10-bit 8-tap mode), dmasize will be the exact size of the data coming in in bits, but imagesize will be the unpacked data size.

◆ pdv_get_cam_width()

int pdv_get_cam_width ( PdvDev  pdv_p)

Returns the camera image width, in pixels, as set by the configuration file directive width.

Parameters
pdv_pThe open PDV device handle.
Returns
The image width in pixels.
See also
pdv_get_width(), width directive in the Camera Configuration Guide.

Not to be confused with pdv_get_width(); this subroutine gets the pdv_p->dd_p->cam_width value which only exists as a place to record the camera's (presumably) full width, as set by the config file 'width' directive and unaffected by any subsequent region of interest or pdv_set_image_size changes. Generally only useful to provide a hint to applications that want to know the original camera size since the value returned doesn't necessarily reflect the actual size of the buffers, as modified by padding, headers or region of interest.

◆ pdv_get_cam_height()

int pdv_get_cam_height ( PdvDev  pdv_p)

Returns the camera image height, in pixels, as set by the configuration file directive height, unaffected by changes made by setting a region of interest. See pdv_set_roi() for more information.

Parameters
pdv_pThe open PDV device handle.
Returns
The image height in pixels.
See also
pdv_get_height(), height directive in the Camera Configuration Guide.

Not to be confused with pdv_get_height(); this subroutine gets the pdv_p->dd_p->cam_height value which only exists as a place to record the camera's (presumably) full height, as set by the config file 'height' directive and unaffected by any subsequent region of interest or pdv_set_image_size changes. This subroutine is just here to give applications a way to remember what that is. Doesn't change the buffer sizes or region of interest – for that, use pdv_set_roi() or pdv_set_image_size().

◆ pdv_check_framesync()

int pdv_check_framesync ( PdvDev  pdv_p,
uint8_t *  image_p,
uint32_t *  framecnt 
)

Checks for frame sync and frame count.

Parameters
pdv_pThe open PDV device handle.
image_pA pointer to previously acquired image (from pdv_wait_images() for example) for which you want the framesync to be checked.
framecntA pointer to location to put frame counter from this frame.
Returns
1 if out of sync is detected, 0 if no out of sync detected, -1 on error.
See also
pdv_enable_framesync(), pdv_framesync_mode()

Framesync is hardware-enabled frame tagging via extra footer data on every frame. With framesync enabled, there are 16 bytes of extra footer data added to the frame DMA, with a magic number and frame count. If the magic number is not correct, framesync will return an error, allowing the calling function to handle the error. Typically this means stopping any continuous capture loop, resetting the DMA via pdv_timeout_restart(), and re-starting continuous capture Or aborting altogether if repeated failures are detected (e.g. misconfiguration, cable unplugged, hardware failure.) The framecount argument allows users to ensure all frames are captured. It is not unusual for frames to be skipped but remain in sync; for example if blanking is very short between frames, or if the OS takes an extra long snooze to go do something else. Subroutine will return -1 if framesync is unsupported or not enabled, 0 if successful, or 1 if an out of sync condition is detected. If return code is 0, framecount will be updated with the current frame count, otherwise framecount will be 0.

Framesync functionality is available in PCIe Camera Link frame grabbers. This subroutine will return -1 if the device does not support this feature.

◆ pdv_enable_framesync()

int pdv_enable_framesync ( PdvDev  pdv_p,
int  mode 
)

Enables frame sync footer and frame out-of-synch detection.

Parameters
pdv_pThe open PDV device handle.
modeThe frame sync mode should be one of:
  • PDV_FRAMESYNC_OFF: Framesync functionality disabled.
  • PDV_FRAMESYNC_ON: Framesync functionality enabled.
  • PDV_FRAMESYNC_EMULATE_TIMEOUT: Framesync errors will be reflected as timeouts.
Returns
0 on success, -1 if not supported by the device in use.
See also
pdv_check_framesync(), pdv_framesync_mode(), pdv_timeouts()

With framesync enabled, extra footer data is added to the frame DMA, enabling you to check for an out-of-synch condition using pdv_check_framesync() or pdv_timeouts(), and respond accordingly.

Framesync functionality is available in PCIe Camera Link framegrabbers except the PCIe4 (no 'a') DV C-Link. No PCI devices support this feature.

◆ pdv_framesync_mode()

int pdv_framesync_mode ( PdvDev  pdv_p)

Returns the frame sync mode.

Can be one of:

  • PDV_FRAMESYNC_OFF: Framesync functionality disabled.
  • PDV_FRAMESYNC_ON: Framesync functionality enabled.
  • PDV_FRAMESYNC_EMULATE_TIMEOUT: Framesync functionality enabled, and framesync errors will be reflected as timeouts.
Parameters
pdv_pThe open PDV device handle.
Returns
1 if enabled, 0 if not enabled.
See also
pdv_enable_framesync(), pdv_check_framesync()

◆ pdv_get_cfgname()

const char * pdv_get_cfgname ( PdvDev  pdv_p)

Get the configuration file name.

Parameters
pdv_pThe open PDV device handle.
Returns
The configuration file name.

◆ pdv_set_defaults()

void pdv_set_defaults ( PdvDev  pdv_p)

Set exposure, gain, and blacklevel to default values.

Parameters
pdv_pThe open PDV device handle.

◆ pdv_enable_external_trigger()

void pdv_enable_external_trigger ( PdvDev  pdv_p,
int  flag 
)

Enables external triggering.

Parameters
pdv_pThe open PDV device handle.
flagOne of:
  • 0 – turn off trigger
  • 1 – turn on photo trigger
  • 2 – turn on field ID trigger (through camera or cable). Does not apply to PCI C-Link.
One of several methods for external triggering. Calling this subroutine will enable the board's external trigger logic. When enabled via this subroutine, the hardware will queue any acquisition request made via pdv_start_images() or similar subroutine, but will not service the request (that is, trigger the camera) until it sees a transition on the external trigger line coming in to the optical trigger pins (TTL level) on the board. If the camera is in freerun mode this of course won't have any effect.

◆ pdv_set_frame_period()

int pdv_set_frame_period ( PdvDev  pdv_p,
int  period,
int  method 
)

Set the frame period counter and enable/disable frame timing.

Parameters
pdv_pThe open PDV device handle.
periodThe frame period in microseconds-2, range 0-16777215
methodOne of:
  • 0 – disable frame counter
  • PDV_FMRATE_ENABLE – continuous frame counter
  • PDV_FVAL_ADJUST – frame counter extends every frame valid by 'period' microseconds
Returns
-1 on error, 0 on success.
See also
pdv_get_frame_period(), frame_period, method_frame_timing directives in the Camera Configuration Guide.

Enables either continuous frame pulses at a specified interval, or extending the frame valid signal by the specified amount, to in- effect extend the amount of time after a frame comes in from the camera before the next trigger is issued. This can be used to hold off on issuing subsequent triggers for cameras that require an extra delay between triggers, or to set a specific trigger interval. Only applies when the camera is in triggered or pulse-width mode and the board is controlling the timing.

The camera config file directives frame_period and method_frame_timing (which pretty much always go together) are typically used to initialize these values at initcam time for cameras that need a fixed frame delay for reliable operation in a given mode (very rare). Frame timing functionality is disabled by default.

◆ pdv_get_frame_period()

int pdv_get_frame_period ( PdvDev  pdv_p)

Get the frame period.

Parameters
pdv_pThe open PDV device handle.
Returns
The frame period in microseconds.
See also
pdv_set_frame_period(), frame_period directive in the Camera Configuration Guide.

Returns the frame period, for boards that support the frame delay / frame period functionality. Frame_period is typically initialized via the frame_period configuration file directive (which pretty much always goes along with the method_frame_timing directive). frame_period is an integer value that determines either the number of microseconds between the start of one frame and the next, or the continuous frame trigger interval, depending on the state of the frame_timing. A more complete description of frame interval and frame timing can be found in pdv_set_frame_period().