EDT PDV SDK Documentation 6.1.0
|
EDT PDV digital imaging library. More...
#include "edt_portability.h"
#include "edt_os_utils.h"
#include "driver/edt_shared_types.h"
#include <stdint.h>
#include <stdbool.h>
Typedefs | |
typedef struct edt_device * | PdvDev |
PDV device handle, an opaque pointer. More... | |
typedef enum edt_pdv_header_type | EdtPdvHeaderType |
typedef enum edt_pdv_header_position | EdtPdvHeaderPosition |
typedef enum edt_pdv_serial_cmd_flag | EdtPdvSerCmdFlag |
Enumerations | |
enum | edt_pdv_header_type { PDV_HDR_TYPE_NONE = 0 , PDV_HDR_TYPE_IRIG1 = 1 , PDV_HDR_TYPE_FRAMECOUNT = 2 , PDV_HDR_TYPE_IRIG2 = 3 , PDV_HDR_TYPE_BUFHEADER = 4 } |
enum | edt_pdv_header_position { } |
enum | edt_pdv_serial_cmd_flag { PDV_SER_CMD_FLAG_NORESP = 1 } |
Functions | |
int | pdv_close (PdvDev pdv_p) |
Closes the specified device and frees the image memory and other resources associated with the device handle. More... | |
EDT_CHECK_RETURN PdvDev | pdv_open (const char *dev_name, int unit) |
Opens channel 0 of an EDT Framegrabber for application access. More... | |
EDT_CHECK_RETURN PdvDev | pdv_open_device (const char *dev_name, int unit, int channel, int verbose) |
Open the pdv device, with option to suppress non-existent device console output. More... | |
EDT_CHECK_RETURN PdvDev | pdv_open_channel (const char *dev_name, int unit, int channel) |
Opens an EDT Framegrabber channel for application access. More... | |
void | pdv_set_debug (int debug) |
Sets the debug level. For values, see the EDT Message Handler Library. More... | |
int | pdv_get_debug (void) |
Gets the debug level, as set by pdv_set_debug or outside environment variables. For values, see the EDT Message Handler Library. More... | |
int | pdv_read (PdvDev pdv_p, unsigned char *buf, unsigned long size) |
Reads image data from the EDT framegrabber board. pdv_read is not supported on all platforms and is included mainly for historical reasons. Consider using pdv_image() or pdv_start_images() instead. More... | |
uint8_t * | pdv_image (PdvDev pdv_p) |
Start image acquisition if not already started, then wait for and return the address of the next available image. More... | |
int | pdv_multibuf (PdvDev pdv_p, int numbufs) |
Sets the number of multiple buffers to use in ring buffer continuous mode, and allocates them. This routine allocates the buffers itself, in kernel or low memory as required by the EDT device driver for optimal DMA. More... | |
void | pdv_start_images (PdvDev pdv_p, int count) |
Starts multiple image acquisition. More... | |
uint8_t ** | pdv_buffer_addresses (PdvDev pdv_p) |
Returns the addresses of the buffers allocated by the last call to pdv_multibuf(). See pdv_wait_images() for a description and example of use. More... | |
uint8_t * | pdv_wait_images (PdvDev pdv_p, int count) |
Waits for the images started by pdv_start_images. More... | |
uint8_t * | pdv_wait_images_timed_raw (PdvDev pdv_p, int count, edt_timespec_t *ts, bool skip_deinterleave) |
Waits for one or more images started by pdv_start_images. Optionally controls post-processing and returns a timestamp. More... | |
uint8_t * | pdv_wait_last_image (PdvDev pdv_p, int *num_skipped) |
Waits for the last image that has been acquired. A convenience wrapper of pdv_wait_last_image_timed_raw(). More... | |
uint8_t * | pdv_wait_last_image_timed_raw (PdvDev pdv_p, int *num_skipped, edt_timespec_t *ts, bool skip_deinterleave) |
Waits for the last image that has been acquired. Optionally controls post-processing and returns a timestamp. More... | |
uint8_t * | pdv_get_last_image (PdvDev pdv_p) |
Returns a pointer to the last image that was acquired (non-blocking). It will return a pointer to the same buffer if called a second time with no new images acquired. More... | |
uint8_t * | pdv_get_last_image_raw (PdvDev pdv_p) |
Returns a pointer to the last image that was acquired (non-blocking). Identical to the pdv_get_last_image(), except that it skips any image deinterleave method defined by the method_interlace config file directive. More... | |
uint8_t * | pdv_wait_next_image (PdvDev pdv_p, int *num_skipped) |
Waits for the next image, skipping any previously started images. A convenience wrapper of pdv_wait_next_image_timed_raw(). More... | |
uint8_t * | pdv_wait_next_image_timed_raw (PdvDev pdv_p, int *num_skipped, edt_timespec_t *ts, bool skip_deinterleave) |
Waits for the next image, skipping any previously started images. Optionally controls post-processing and returns a timestamp. More... | |
double | pdv_decode_timestamp (const edt_timespec_t *ts) |
Decode the timestamp from pdv_wait_images_timed_raw and related functions. More... | |
void | pdv_setup_continuous (PdvDev pdv_p) |
Performs setup for continuous transfers. More... | |
void | pdv_stop_continuous (PdvDev pdv_p) |
Performs un-setup for continuous transfers. More... | |
int | pdv_in_continuous (PdvDev pdv_p) |
Gets the status of the continuous flag. More... | |
void | pdv_flush_fifo (PdvDev pdv_p) |
Flushes the board's input FIFOs, to allow new data transfers to start from a known state. More... | |
int | pdv_set_timeout (PdvDev pdv_p, int value) |
Sets the length of time to wait for data on acquisition before timing out. More... | |
int | pdv_get_timeout (PdvDev pdv_p) |
Gets the length of time to wait for data on acquisition before timing out. More... | |
int | pdv_timeouts (PdvDev pdv_p) |
Returns the number of times the device timed out (frame didn't transfer completely or at all) since the device was opened. More... | |
int | pdv_timeout_restart (PdvDev pdv_p, int restart) |
Cleans up after a timeout, particularly when you've prestarted multiple buffers or if you've forced a timeout with edt_do_timeout(). More... | |
int | pdv_overrun (PdvDev pdv_p) |
Determines whether data overran on the last aquire. More... | |
void | pdv_check_frame (PdvDev pdv_p, u_short *image, u_int imagesize, int verbose) |
Search an image buffer for a valid frame. If the beginning of the image was not at the start of the image buffer, stop and re-start continuous image aquisition. More... | |
u_char * | pdv_get_interleave_data (PdvDev pdv_p, u_char *buf, int bufnum) |
Returns the post-processed data corresponding to a given raw buffer. It does not cause post-processing to happen, it only returns the data if it already exists. More... | |
int | pdv_get_force_single (PdvDev pdv_p) |
Returns the value of the force_single flag. This flag is 0 by default, and is set by the force_single directive in the config file. More... | |
void | pdv_set_fval_done (PdvDev pdv_p, int enable) |
Enables frame valid done functionality on the board. More... | |
int | pdv_get_fval_done (PdvDev pdv_p) |
Returns the frame valid done enable state. More... | |
int | pdv_get_lines_xferred (PdvDev pdv_p) |
Gets the number of lines transferred during the last acquire. Typically only used in line scan applications where the actual number of lines transferred into a given buffer is unknown at the time of the acquire. More... | |
int | pdv_get_width_xferred (PdvDev pdv_p) |
Gets the number of pixels transferred during the last line transferred. Typically only used in line scan applications where the actual number of pixels transferred per line may not be known. More... | |
int | pdv_cl_get_fval_counter (PdvDev pdv_p) |
Gets the number of frame valid transitions that have been seen by the board since the last time the board/channel was initialized or the last time pdv_cl_reset_fval_counter() was called. More... | |
void | pdv_cl_reset_fval_counter (PdvDev pdv_p) |
Resets the frame valid counter to zero. More... | |
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, u_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, u_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, u_char *image_p, u_int *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... | |
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... | |
int | pdv_serial_set_baud (PdvDev pdv_p, int baud) |
Sets the baud rate on the serial lines; applies only to cameras with serial control. Valid values are 9600, 19200, 38500, 57500, and 115200. More... | |
int | pdv_serial_get_baud (PdvDev pdv_p) |
Get the baud rate, typically initialized by the serial_baud directive in the config file. More... | |
int | pdv_serial_command (PdvDev pdv_p, const char *cmd) |
Sends an ASCII serial command to the camera, with ASCII camera command formatting. Applies only to cameras that use a serial control method for camera-computer communications. More... | |
int | pdv_serial_binary_command (PdvDev pdv_p, const uint8_t *cmd, int len) |
Sends a binary serial command to the camera. Applies only to cameras that use a serial control method for for camera-computer communications. More... | |
int | pdv_serial_write_available (PdvDev pdv_p) |
Get the number of bytes available in the driver's serial write buffer. More... | |
int | pdv_serial_write (PdvDev pdv_p, const char *buf, int size) |
Performs a serial write over the serial lines. Not recommended for use in new code, consider using pdv_serial_command() or pdv_serial_binary_command() instead. More... | |
int | pdv_serial_read (PdvDev pdv_p, char *buf, int size) |
Performs a serial read over the serial control lines. More... | |
int | pdv_serial_read_blocking (PdvDev pdv_p, char *buf, int size) |
Performs a serial read over the serial control lines, blocks until all requested data is read. More... | |
int | pdv_serial_read_nullterm (PdvDev pdv_p, char *buf, int size, int nullterm) |
Performs a serial read over the serial control lines. The buffer passed in will be NULL-terminated if nullterm is true. More... | |
void | pdv_serial_set_delimiters (PdvDev pdv_p, const char *newprefix, const char *newterm) |
Set the prefix and terminator for serial commands. More... | |
const char * | pdv_serial_prefix (PdvDev pdv_p) |
Get the serial prefix. More... | |
const char * | pdv_serial_term (PdvDev pdv_p) |
Get the serial terminator. More... | |
void | pdv_serial_send_break (PdvDev pdv_p) |
Send a break condition on the serial connection. More... | |
void | pdv_serial_reset (PdvDev pdv_p) |
Resets the serial interface. Clears any outstanding reads and writes and puts the serial interface in a known idle state. More... | |
int | pdv_serial_read_basler (PdvDev pdv_p, u_char *cmd, int len) |
Reads a Basler binary frame command. Checks the framing and BCC. More... | |
int | pdv_serial_write_basler (PdvDev pdv_p, u_char *cmd, int len) |
Send a Basler formatted serial frame. Adds the framing and BCC. More... | |
int | pdv_serial_read_duncan (PdvDev pdv_p, u_char *frame) |
Read a binary serial response from a Duncantech MS and DT series camera – checks for STX and size, then waits for size+1 more bytes. More... | |
int | pdv_serial_write_duncan (PdvDev pdv_p, u_char *cmdbuf, int size) |
Send a Duncantech MS / DT series camera frame – adds the framing and checksum, then sends the command. More... | |
int | pdv_serial_wait (PdvDev pdv_p, int msecs, int count) |
Waits for a response from the camera as a result of a pdv_serial_write() or pdv_serial_command(). More... | |
int | pdv_serial_wait_next (PdvDev pdv_p, int msecs, int count) |
Wait for new serial data to come in. Ignore any previously received data. More... | |
int | pdv_serial_set_waitchar (PdvDev pdv_p, int enable, u_char wchar) |
Set the serial wait character. More... | |
int | pdv_serial_get_waitchar (PdvDev pdv_p, u_char *wchar) |
Get serial wait character. More... | |
int | pdv_serial_get_numbytes (PdvDev pdv_p) |
Returns the number of bytes of unread data in the serial response buffer. More... | |
int | pdv_serial_get_block_size (void) |
Returns the block size for serial writes. More... | |
void | pdv_serial_set_block_size (int newsize) |
Sets the block size for serial writes. More... | |
int | pdv_serial_get_timeout (PdvDev pdv_p) |
Get the value of the serial timeout. More... | |
int | pdv_get_pause_for_serial (PdvDev pdv_p) |
Get the serial pause time, in milliseconds. More... | |
void | pdv_free (void *ptr) |
Convenience routine to free the memory allocated with pdv_alloc(). More... | |
void * | pdv_alloc (int size) |
Convenience routine to allocate memory in a system-independent way. More... | |
int | pdv_access (const char *fname, int perm) |
Determines file access independent of operating system. This a convenience routine that maps to access() on Unix/Linux systems, and _access on Windows systems. More... | |
void | pdv_mark_ras_depth (void *addr, int n, int width, int height, int x, int y, int depth, int fg) |
Draws the digits of a number into an image buffer. More... | |
int | pdv_bytes_per_line (int width, int depth) |
Returns bytes per line based on width and bit depth, including depth < 8. More... | |
int | pdv_cl_camera_connected (PdvDev pdv_p) |
Checks whether a camera is connected and turned on. More... | |
int | pdv_is_cameralink (PdvDev pdv_p) |
Infers that this device is connected to is a Camera Link camera (as opposed to RS-422 or LVDS parallel), based on settings from the loaded camera config file. More... | |
int | pdv_is_simulator (PdvDev pdv_p) |
Infers that this device is a simulator, e.g. VisionLink CLS. More... | |
EDT PDV digital imaging library.
Provides a 'C' language interface to the EDT PCI bus Digital Imaging Camera/Device Capture family of products. All routines access a specific device, whose handle is created and returned by the pdv_open() routine.
typedef struct edt_device* PdvDev |
PDV device handle, an opaque pointer.
For convenience, we use PdvDev in PDV applications, and EdtDev in applications for all other EDT applications. PdvDev and EdtDev are interchangable, some functions from edtlib can be called using a PdvDev handle.
typedef enum edt_pdv_header_type EdtPdvHeaderType |
Definition for header data for buffers.
typedef enum edt_pdv_header_position EdtPdvHeaderPosition |
Position of header relative to the bounds of a DMA buffer.
For disk I/O speed, header memory may be allocated with ring-buffer memory even if the header is not in the DMA stream. This covers all possible relationships of header memory to image data.
typedef enum edt_pdv_serial_cmd_flag EdtPdvSerCmdFlag |
Serial command flags. Generally not used in application code.
enum edt_pdv_header_type |
Position of header relative to the bounds of a DMA buffer.
For disk I/O speed, header memory may be allocated with ring-buffer memory even if the header is not in the DMA stream. This covers all possible relationships of header memory to image data.