Most PDV utility routines have a dvu_
prefix. dvu_
subroutines are not necessarily specific to the EDT digital imaging hardware. For example, dvu_write_rasfile could concievably 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.
Defines | |
#define | BI_BITFIELDS 3L |
#define | BI_RGB 0L |
#define | BI_RLE4 2L |
#define | BI_RLE8 1L |
#define | BYTE unsigned char |
#define | DVUFATAL PDVLIB_MSG_FATAL |
#define | DWORD unsigned int |
#define | LONG int |
#define | RAS_MAGIC 0x59a66a95 |
#define | RMT_EQUAL_RGB 1 |
#define | RMT_NONE 0 |
#define | RT_STANDARD 1 |
#define | WIDTHBYTES(bits) (((bits) + 31) / 32 * 4) |
#define | WORD unsigned short |
Functions | |
int | dvu_exp_histeq (u_char *src, u_char *dst, int size, int depth, int cutoff) |
Perform a histogram equalization on an image, with cutoff (experimental). | |
void | dvu_free_tables () |
int | dvu_free_window (dvu_window *w) |
int | dvu_histeq (u_char *src, u_char *dst, int size, int depth) |
Perform a histogram equalization on an image. | |
dvu_window * | dvu_init_window (u_char *data, int sx, int sy, int dx, int dy, int xdim, int ydim, int depth) |
int | dvu_load_lookup (char *filename, int depth) |
void | dvu_long_to_charbuf (unsigned int val, u_char *buf) |
int | dvu_lookup (u_char *src, u_char *dst, int size, int depth) |
void | dvu_perror (char *str) |
dvu_window * | dvu_read_window (char *fname) |
dvu_window * | dvu_reset_window (dvu_window *s, u_char *data, int sx, int sy, int dx, int dy) |
int | dvu_save_lookup (char *filename, int depth) |
int | dvu_winscale (dvu_window *wi, dvu_window *bi, int minbyte, int maxbyte, int doinit) |
int | dvu_word2byte (u_short *wbuf, u_char *bbuf, int count, int depth) |
int | dvu_word2byte_with_stride (u_short *wbuf, u_char *bbuf, int wstride, int bstride, int xsize, int ysize, int depth) |
int | dvu_wordscale (u_short *words, u_char *bytes, int count, int minbyte, int maxbyte, int doinit) |
int | 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. | |
int | dvu_write_bmp_24 (char *fname, u_char *buffer, int width, int height) |
Writes a 24-bit per pixel RGB data buffer as a Windows bitmap file. | |
int | 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. | |
int | 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. | |
int | 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). | |
int | 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. | |
int | 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. | |
int | 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). | |
int | dvu_write_window (char *fname, dvu_window *w) |
int | pdv_access (char *fname, int perm) |
Determines file access independent of operating system. | |
uchar_t * | pdv_alloc (int size) |
Convenience routine to allocate memory in a system-independent way. | |
int | pdv_bytes_per_line (int width, int depth) |
Returns bytes per line based on width and bit depth, including depth < 8. | |
int | pdv_cl_camera_connected (PdvDev *pdv_p) |
Checks whether a camera is connected and turned on. | |
void | pdv_free (uchar_t *ptr) |
Convenience routine to free the memory allocated with pdv_alloc. | |
int | pdv_is_atmel (PdvDev *pdv_p) |
Infers that this device is connected to is an Atmel camera, based on the camera_class directive. | |
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. | |
int | pdv_is_dvc (PdvDev *pdv_p) |
Infers that this device is connected to is a DVC camera, from settings from the loaded camera config file. | |
int | pdv_is_hamamatsu (PdvDev *pdv_p) |
Infers that this device is connected to is a Hamamatsu camera based on the camera class string. | |
int | pdv_is_kodak_i (PdvDev *pdv_p) |
Infer if it's a Redlake (formerly Roper, formerly Kodak) 'i' camera from the serial settings. | |
int | pdv_is_simulator (PdvDev *pdv_p) |
Infers that this device is a simulator -- either a PCI DV CLS board, or a PCIe DV C-Link with simulator FPGA loaded. | |
void | pdv_perror (char *err) |
Formats and prints a system error. | |
int | pdv_update_values_from_camera (PdvDev *pdv_p) |
Deprecated -- Queries certain specific cameras via serial, and sets library variables for gain, black level, exposure time and binning to values based on the results of the query. | |
int | ten2one (u_short *wbuf, u_char *bbuf, int count) |
Variables | |
int | Pdv_debug |
int dvu_exp_histeq | ( | u_char * | src, | |
u_char * | dst, | |||
int | size, | |||
int | depth, | |||
int | cutoff | |||
) |
int dvu_histeq | ( | u_char * | src, | |
u_char * | dst, | |||
int | size, | |||
int | depth | |||
) |
int 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=dvu_write_bmp("file.bmp", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p) );
fname | filename | |
buffer | data buffer, one byte per pixel | |
width | number of pixels (bytes) per line | |
height | number of lines in the image |
int dvu_write_bmp_24 | ( | char * | fname, | |
u_char * | buffer, | |||
int | width, | |||
int | height | |||
) |
Writes a 24-bit per pixel RGB data buffer as a Windows bitmap file.
Example
int err=dvu_write_bmp("file.bmp", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p);
fname | filename | |
buffer | data buffer, one byte per pixel | |
width | number of pixels (bytes) per line | |
height | number of lines in the image |
int 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.
fname | the name of the output file | |
addr | the address of the image data (8 bits per pixel) | |
x_size | width in pixels of image | |
y_size | height in pixels of image | |
istride | number 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). |
int 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.
fname | the name of output file | |
addr | data buffer, three bytes per pixel (RGB) | |
x_size | number of pixels per line | |
y_size | number of lines in the image | |
istride | number of pixels to skip between sucessive lines |
// skip every other line int err=dvu_write_image24("file.ras", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p) / 2, pdv_get_width(pdv_p) );
int 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).
fname | the name of the output file | |
addr | the address of the image data (8 bits per pixel) | |
x_size | width in pixels of image | |
y_size | height in pixels of image |
int 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.
fname | the name of the output file | |
addr | the address of the image data (8 bits per pixel) | |
x_size | width in pixels of image | |
y_size | height in pixels of image | |
depth_bits | number of bits per pixel |
int dvu_write_rasfile24 | ( | char * | fname, | |
u_char * | addr, | |||
int | x_size, | |||
int | y_size | |||
) |
int 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=dvu_write_raw(pdv_get_imagesize(pdv_p), buf_p, "file.raw");
imagesize | number of bytes in the image. | |
imagebuf | pointer to image data buffer. | |
fname | output file name. |
int pdv_access | ( | 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.
fname | path name of the file to check access of. | |
perm | permission flag(s) to test for. See access() (Unix/Linux) or _access (Windows) for valid arguments. |
if (pdv_access("file.ras", F_OK)) print("Warning: about to overwrite file %s/n", "file.ras");
uchar_t* 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.
Example
unsigned char *buf = pdv_alloc(pdv_image_size(pdv_p));
size | the number of bytes of memory to allocate |
int pdv_bytes_per_line | ( | int | width, | |
int | depth | |||
) |
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.
void pdv_free | ( | uchar_t * | ptr | ) |
int pdv_is_atmel | ( | PdvDev * | pdv_p | ) |
Infers that this device is connected to is an Atmel camera, based on the camera_class directive.
pdv_p | pointer to pdv device structure returned by pdv_open |
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.
Generally useful only for applications that may use both Camera Link and the (older) AIA cameras, and that need to differentiate between the two. Specifically for framegrabbers, will return false (0) for simulators.
pdv_p | device handle returned by pdv_open |
int pdv_is_dvc | ( | PdvDev * | pdv_p | ) |
int pdv_is_hamamatsu | ( | PdvDev * | pdv_p | ) |
int pdv_is_kodak_i | ( | PdvDev * | pdv_p | ) |
Infer if it's a Redlake (formerly Roper, formerly Kodak) 'i' camera from the serial settings.
Since serial commands have changed quite a bit over the years, this subroutine should not be depended on and is only included for backwards compatability.
pdv_p | pointer to pdv device structure returned by pdv_open |
int pdv_is_simulator | ( | PdvDev * | pdv_p | ) |
void pdv_perror | ( | char * | err | ) |
Formats and prints a system error.
Convenience function to format and print a system error. In Linux implementations, the routine just turns around and makes a perror system call, with the errstr argument. NT implementations format and print the last error using GetLastErrorString.
int pdv_update_values_from_camera | ( | PdvDev * | pdv_p | ) |
Deprecated -- Queries certain specific cameras via serial, and sets library variables for gain, black level, exposure time and binning to values based on the results of the query.
Included for backwards compatability only. The cameras supported are all older (pre-2000) cameras made by Kodak Megaplus 'i', Hamamatsu, DVC, and Atmel.
This subroutine will be removed in a future release and should not be used.
pdv_p | pointer to pdv device structure returned by pdv_open |