EDT PDV SDK Documentation 6.1.0
Collaboration diagram for Utility:

Functions

int edt_dvu_write_rasfile (char *fname, u_char *addr, int x_size, int y_size)
 Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform). More...
 
int edt_dvu_write_rasfile16 (char *fname, u_char *addr, int x_size, int y_size, int depth_bits)
 Converts 1 band, 10-16 bit image to a sun raster format file and writes to a file. More...
 
int edt_dvu_write_image (char *fname, u_char *addr, int x_size, int y_size, int istride)
 Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform), with stride. This function can be used to output a partial image. For example, to output the top left 100x100 pixels of the image, specify x_size of 100 and y_size * 100, and an istride of the actual width of the image. More...
 
int edt_dvu_write_rasfile24 (char *fname, u_char *addr, int x_size, int y_size)
 Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file. More...
 
int edt_dvu_write_image24 (char *fname, u_char *addr, int x_size, int y_size, int istride)
 Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file, with stride. More...
 
int edt_dvu_write_bmp (char *fname, u_char *buffer, int width, int height)
 Writes an 8-bit per pixel data buffer as a grayscale Windows bitmap file. More...
 
int edt_dvu_write_raw (int imagesize, u_char *imagebuf, char *fname)
 Writes a 24-bit per pixel RGB data buffer as a raw data file (no formatting). 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...
 

Detailed Description

Various utility subroutines. Most PDV utility routines have a dvu_ prefix. dvu_ subroutines are not necessarily specific to the EDT digital imaging hardware. For example, edt_dvu_write_rasfile could conceivably be used to write a raster file from any source, not just one captured by an EDT framegrabber. As such, dvu_ subroutines do not operate on an PdvDev device handle in their parameter lists.

There are a few utility subroutines that don't take a PdvDev device handle but do have a pdv_ prefix, and may or may not have some PDV specificity.

The remaining pdv_ subroutines that do take a PdvDev device handle are tagged as utility subroutines because they do not fit any other category.

Function Documentation

◆ edt_dvu_write_rasfile()

int edt_dvu_write_rasfile ( char *  fname,
u_char *  addr,
int  x_size,
int  y_size 
)

Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform).

Parameters
fnameThe name of the output file.
addrThe address of the image data (8 bits per pixel).
x_sizeWidth in pixels of image.
y_sizeHeight in pixels of image.
Returns
0 on success, -1 on failure

◆ edt_dvu_write_rasfile16()

int edt_dvu_write_rasfile16 ( char *  fname,
u_char *  addr,
int  x_size,
int  y_size,
int  depth 
)

Converts 1 band, 10-16 bit image to a sun raster format file and writes to a file.

Parameters
fnameThe name of the output file.
addrThe address of the image data (8 bits per pixel).
x_sizeWidth in pixels of image.
y_sizeHeight in pixels of image.
depth_bitsNumber of bits per pixel
Returns
0 on success, -1 on failure

◆ edt_dvu_write_image()

int edt_dvu_write_image ( char *  fname,
u_char *  addr,
int  x_size,
int  y_size,
int  istride 
)

Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform), with stride. This function can be used to output a partial image. For example, to output the top left 100x100 pixels of the image, specify x_size of 100 and y_size * 100, and an istride of the actual width of the image.

Note
Use edt_dvu_write_rasfile to output a full image in the most efficient way.
Parameters
fnameThe name of the output file.
addrThe address of the image data (8 bits per pixel).
x_sizeWidth in pixels of image.
y_sizeHeight in pixels of image.
istrideNumber of pixels (bytes) to skip from one the beginning of one line to the beginning of the next (this should just be the image width, unless you want something weird like a diagonally skewed image).
Returns
0 on success, -1 on failure

◆ edt_dvu_write_rasfile24()

int edt_dvu_write_rasfile24 ( char *  fname,
u_char *  addr,
int  x_size,
int  y_size 
)

Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file.

Parameters
fnameFile name.
addrData buffer, three bytes per pixel (RGB).
x_sizeNumber of pixels per line.
y_sizeNumber of lines in the image.
Returns
0 on success, -1 on failure

◆ edt_dvu_write_image24()

int edt_dvu_write_image24 ( char *  fname,
u_char *  addr,
int  x_size,
int  y_size,
int  istride 
)

Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file, with stride.

@Example

// skip every other line
int err=edt_dvu_write_image24("file.ras", buf_p,
pdv_get_width(pdv_p),
pdv_get_height(pdv_p) / 2,
);

◆ edt_dvu_write_bmp()

int edt_dvu_write_bmp ( char *  fname,
u_char *  buffer,
int  width,
int  height 
)

Writes an 8-bit per pixel data buffer as a grayscale Windows bitmap file.

@Example

int err=edt_dvu_write_bmp("file.bmp", buf_p,
pdv_get_width(pdv_p),
);

◆ edt_dvu_write_raw()

int edt_dvu_write_raw ( int  imagesize,
u_char *  imagebuf,
char *  fname 
)

Writes a 24-bit per pixel RGB data buffer as a raw data file (no formatting).

@Example

int err=edt_dvu_write_raw(pdv_get_image_size(pdv_p), buf_p, "file.raw");

◆ pdv_free()

void pdv_free ( void *  ptr)

Convenience routine to free the memory allocated with pdv_alloc().

Parameters
ptrAddress of memory buffer to free.
Here is the call graph for this function:

◆ pdv_alloc()

void * pdv_alloc ( int  size)

Convenience routine to allocate memory in a system-independent way.

The buffer returned is page aligned. Page alignment is required for some EDT image routines and always preferred. This function uses VirtualAlloc on Windows NT/2000/XP systems, or valloc on Linux/Unix systems.

Parameters
sizeThe number of bytes of memory to allocate
Returns
The address of the allocated memory, or NULL on error. If NULL, use edt_msg_perror() to print the error.
See also
pdv_free()
Here is the call graph for this function:

◆ pdv_access()

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.

Parameters
fnameThe path name of the file to check access of.
permThe permission flag(s) to test for. See access() (Unix/Linux) or _access (Windows) for valid arguments.
Returns
0 on success, -1 on failure.
Here is the call graph for this function:

◆ pdv_mark_ras_depth()

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.

Parameters
addrThe address of the image to be marked.
nThe number to be marked into the image.
widthThe width of the image.
heightThe height of the image.
xThe position in the image where the number will be drawn.
yThe position in the image where the number will be drawn.
depthThe number of bits per pixel of the image.
fgThe color value to use for drawing the digits.

◆ pdv_bytes_per_line()

int pdv_bytes_per_line ( int  width,
int  depth 
)

Returns bytes per line based on width and bit depth, including depth < 8.

Parameters
widthPixels per line.
depthBits per pixel.
Returns
Bytes per line.
Here is the caller graph for this function:

◆ pdv_cl_camera_connected()

int pdv_cl_camera_connected ( PdvDev  pdv_p)

Checks whether a camera is connected and turned on.

Looks for an active (changing) pixel clock from the camera, and returns 1 if detected.

Parameters
pdv_pThe open PDV device handle.
Returns
1 if a pixel clock is detected, 0 if not detected.
Here is the call graph for this function:

◆ pdv_is_cameralink()

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.

Specifically for framegrabbers, will return false (0) for simulators.

Parameters
pdv_pThe open PDV device handle.
Returns
1 if Camera Link framegrabber, 0 otherwise.
Here is the caller graph for this function:

◆ pdv_is_simulator()

int pdv_is_simulator ( PdvDev  pdv_p)

Infers that this device is a simulator, e.g. VisionLink CLS.

Parameters
pdv_pThe open PDV device handle.
Returns
1 if a simulator, 0 otherwise.
Here is the call graph for this function: