IM: Image Capture

From IM - Imaging Libray

Image Capture


Detailed Description

Captures images from video devices.
You must link the application with "im_capture.lib/.a/.so".
Depends also on the Direct Show 9 SDK, you must link with "strmiids.lib". When using the "im_capture.dll" this extra library is not necessary. Since DX uses COM, CoInitialize(NULL) is called when the devices are enumerated.
For more information:
http://msdn.microsoft.com/library/en-us/directx9_c/directX/htm/directshow.asp
See im_capture.h


Modules

group  Windows Attributes

Functions

int imVideoCaptureDeviceCount (void)
const char * imVideoCaptureDeviceDesc (int device)
int imVideoCaptureReloadDevices (void)
imVideoCapture * imVideoCaptureCreate (void)
void imVideoCaptureDestroy (imVideoCapture *vc)
int imVideoCaptureConnect (imVideoCapture *vc, int device)
void imVideoCaptureDisconnect (imVideoCapture *vc)
int imVideoCaptureShowDialog (imVideoCapture *vc, int dialog, void *parent)
int imVideoCaptureDialogCount (imVideoCapture *vc)
const char * imVideoCaptureDialogDesc (imVideoCapture *vc, int dialog)
void imVideoCaptureGetImageSize (imVideoCapture *vc, int *width, int *height)
int imVideoCaptureSetImageSize (imVideoCapture *vc, int width, int height)
int imVideoCaptureFrame (imVideoCapture *vc, unsigned char *data, int color_mode, int timeout)
int imVideoCaptureOneFrame (imVideoCapture *vc, unsigned char *data, int color_mode)
int imVideoCaptureLive (imVideoCapture *vc, int live)
int imVideoCaptureResetAttribute (imVideoCapture *vc, const char *attrib, int fauto)
int imVideoCaptureGetAttribute (imVideoCapture *vc, const char *attrib, float *percent)
int imVideoCaptureSetAttribute (imVideoCapture *vc, const char *attrib, float percent)
const char ** imVideoCaptureGetAttributeList (imVideoCapture *vc, int *num_attrib)

Function Documentation

int imVideoCaptureDeviceCount (  void   ) 
 

Returns the number of available devices.

const char* imVideoCaptureDeviceDesc (  int  device  ) 
 

Returns the device description. Returns NULL in the last device.

int imVideoCaptureReloadDevices (  void   ) 
 

Reload the device list. The devices can be dynamically removed or added to the system.

imVideoCapture* imVideoCaptureCreate (  void   ) 
 

Creates a new imVideoCapture object.
Returns NULL if there is no capture device available.
In Windows returns NULL if DirectX version is older than 8.

void imVideoCaptureDestroy (  imVideoCapture *  vc  ) 
 

Destroys a imVideoCapture object.

int imVideoCaptureConnect (  imVideoCapture *  vc,
int  device
) 
 

Connects to a capture device. More than one imVideoCapture object can be created but they must be connected to different devices.
If the object is conected it will disconnect first.
Use -1 to return the current connected device, in this case returns -1 if not connected.
Returns zero if failed.

void imVideoCaptureDisconnect (  imVideoCapture *  vc  ) 
 

Disconnect from a capture device.

int imVideoCaptureShowDialog (  imVideoCapture *  vc,
int  dialog,
void *  parent
) 
 

Displays a configuration modal dialog of the connected device.
In Windows, the capturing will be stopped in some cases.
In Windows parent is a HWND of a parent window, it can be NULL.
Returns zero if failed.

int imVideoCaptureDialogCount (  imVideoCapture *  vc  ) 
 

Returns the number of available configuration dialogs.

const char* imVideoCaptureDialogDesc (  imVideoCapture *  vc,
int  dialog
) 
 

Returns the description of a configuration dialog.

void imVideoCaptureGetImageSize (  imVideoCapture *  vc,
int *  width,
int *  height
) 
 

Returns the current image size of the connected device.
width and height returns 0 if not connected.

int imVideoCaptureSetImageSize (  imVideoCapture *  vc,
int  width,
int  height
) 
 

Changes the image size of the connected device.
Returns zero if failed.

int imVideoCaptureFrame (  imVideoCapture *  vc,
unsigned char *  data,
int  color_mode,
int  timeout
) 
 

Returns a new captured frame. Use -1 for infinite timeout.
Color space can be IM_RGB or IM_GRAY, and mode can be packed (IM_PACKED) or not.
It can not have an alpha channel and orientation is always bottom up.
Returns zero if failed or timeout expired, the buffer is not changed.

int imVideoCaptureOneFrame (  imVideoCapture *  vc,
unsigned char *  data,
int  color_mode
) 
 

Start capturing, returns the new captured frame and stop capturing.
This is more usefull if you are switching between devices.
Data format is the same as imVideoCaptureFrame.
Returns zero if failed.

int imVideoCaptureLive (  imVideoCapture *  vc,
int  live
) 
 

Start capturing.
Use -1 to return the current state.
Returns zero if failed.

int imVideoCaptureResetAttribute (  imVideoCapture *  vc,
const char *  attrib,
int  fauto
) 
 

Resets a camera or video attribute to the default value or to the automatic setting.
Not all attributes support automatic modes.
Returns zero if failed.

int imVideoCaptureGetAttribute (  imVideoCapture *  vc,
const char *  attrib,
float *  percent
) 
 

Returns a camera or video attribute in percentage of the valid range value.
Returns zero if failed.

int imVideoCaptureSetAttribute (  imVideoCapture *  vc,
const char *  attrib,
float  percent
) 
 

Changes a camera or video attribute in percentage of the valid range value.
Returns zero if failed.

const char** imVideoCaptureGetAttributeList (  imVideoCapture *  vc,
int *  num_attrib
) 
 

Returns a list of the description of the valid attributes.