IM: Image Capture

IM - An Imaging Tool

Image Capture


Detailed Description

Functions to capture images from live video devices.
See im_capture.h

Modules

 Windows Attributes Names

Functions

int IM_DECL imVideoCaptureDeviceCount (void)
const char *IM_DECL imVideoCaptureDeviceDesc (int device)
const char * imVideoCaptureDeviceExDesc (int device)
const char * imVideoCaptureDevicePath (int device)
const char * imVideoCaptureDeviceVendorInfo (int device)
int IM_DECL imVideoCaptureReloadDevices (void)
imVideoCapture *IM_DECL imVideoCaptureCreate (void)
void IM_DECL imVideoCaptureDestroy (imVideoCapture *vc)
int IM_DECL imVideoCaptureConnect (imVideoCapture *vc, int device)
void IM_DECL imVideoCaptureDisconnect (imVideoCapture *vc)
int IM_DECL imVideoCaptureDialogCount (imVideoCapture *vc)
int IM_DECL imVideoCaptureShowDialog (imVideoCapture *vc, int dialog, void *parent)
int imVideoCaptureSetInOut (imVideoCapture *vc, int input, int output, int cross)
const char *IM_DECL imVideoCaptureDialogDesc (imVideoCapture *vc, int dialog)
int IM_DECL imVideoCaptureFormatCount (imVideoCapture *vc)
int IM_DECL imVideoCaptureGetFormat (imVideoCapture *vc, int format, int *width, int *height, char *desc)
int IM_DECL imVideoCaptureSetFormat (imVideoCapture *vc, int format)
void IM_DECL imVideoCaptureGetImageSize (imVideoCapture *vc, int *width, int *height)
int IM_DECL imVideoCaptureSetImageSize (imVideoCapture *vc, int width, int height)
int IM_DECL imVideoCaptureFrame (imVideoCapture *vc, unsigned char *data, int color_mode, int timeout)
int IM_DECL imVideoCaptureOneFrame (imVideoCapture *vc, unsigned char *data, int color_mode)
int IM_DECL imVideoCaptureLive (imVideoCapture *vc, int live)
int IM_DECL imVideoCaptureResetAttribute (imVideoCapture *vc, const char *attrib, int fauto)
int IM_DECL imVideoCaptureGetAttribute (imVideoCapture *vc, const char *attrib, float *percent)
int IM_DECL imVideoCaptureSetAttribute (imVideoCapture *vc, const char *attrib, float percent)
const char **IM_DECL imVideoCaptureGetAttributeList (imVideoCapture *vc, int *num_attrib)

Function Documentation

int IM_DECL imVideoCaptureDeviceCount void   ) 
 

Returns the number of available devices.

im.VideoCaptureDeviceCount() -> count: number [in Lua 5] 

const char* IM_DECL imVideoCaptureDeviceDesc int  device  ) 
 

Returns the device description. Returns NULL only if it is an invalid device.

im.VideoCaptureDeviceDesc(device: number) -> desc: string [in Lua 5] 

const char* imVideoCaptureDeviceExDesc int  device  ) 
 

Returns the extendend device description. May return NULL.

im.VideoCaptureDeviceExDesc(device: number) -> desc: string [in Lua 5] 

const char* imVideoCaptureDevicePath int  device  ) 
 

Returns the device path configuration. This is a unique string.

im.VideoCaptureDevicePath(device: number) -> desc: string [in Lua 5] 

const char* imVideoCaptureDeviceVendorInfo int  device  ) 
 

Returns the vendor information. May return NULL.

im.VideoCaptureDeviceVendorInfo(device: number) -> desc: string [in Lua 5] 

int IM_DECL imVideoCaptureReloadDevices void   ) 
 

Reload the device list. The devices can be dynamically removed or added to the system. Returns the number of available devices.

im.imVideoCaptureReloadDevices() -> count: number [in Lua 5] 

imVideoCapture* IM_DECL 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.

im.VideoCaptureCreate() -> vc: imVideoCapture [in Lua 5] 

void IM_DECL imVideoCaptureDestroy imVideoCapture *  vc  ) 
 

Destroys a imVideoCapture object.

im.VideoCaptureDestroy(vc: imVideoCapture) [in Lua 5] 
vc:Destroy() [in Lua 5] 

int IM_DECL 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.

vc:Connect([device: number]) -> ret: number [in Lua 5] 

void IM_DECL imVideoCaptureDisconnect imVideoCapture *  vc  ) 
 

Disconnect from a capture device.

vc:Disconnect() [in Lua 5] 

int IM_DECL imVideoCaptureDialogCount imVideoCapture *  vc  ) 
 

Returns the number of available configuration dialogs.

vc:DialogCount() -> count: number [in Lua 5] 

int IM_DECL 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.
dialog can be from 0 to imVideoCaptureDialogCount.
Returns zero if failed.

vc:ShowDialog(dialog: number, parent: userdata) -> error: number [in Lua 5] 

int imVideoCaptureSetInOut imVideoCapture *  vc,
int  input,
int  output,
int  cross
 

Allows to control the input and output of devices that have multiple input and outputs. cross controls in which stage the input/output will be set. Usually use 1, but some capture boards has a second stage. In Direct X it controls the crossbars.

vc:SetInOut(input, output, cross: number) -> error: number [in Lua 5] 

const char* IM_DECL imVideoCaptureDialogDesc imVideoCapture *  vc,
int  dialog
 

Returns the description of a configuration dialog. dialog can be from 0 to imVideoCaptureDialogCount.

vc:DialogDesc(dialog: number) -> desc: string [in Lua 5] 

int IM_DECL imVideoCaptureFormatCount imVideoCapture *  vc  ) 
 

Returns the number of available video formats.
Returns zero if failed.

vc:FormatCount() -> error: number [in Lua 5] 

int IM_DECL imVideoCaptureGetFormat imVideoCapture *  vc,
int  format,
int *  width,
int *  height,
char *  desc
 

Returns information about the video format.
format can be from 0 to imVideoCaptureFormatCount.
desc should be of size 10.
The image size is usually the maximum size for that format. Other sizes can be available using imVideoCaptureSetImageSize.
Returns zero if failed.

vc:GetFormat(format: number) -> error: number, width: number, height: number, desc: string [in Lua 5] 

int IM_DECL imVideoCaptureSetFormat imVideoCapture *  vc,
int  format
 

Changes the video format of the connected device.
Should NOT work for DV devices. Use imVideoCaptureSetImageSize only.
Use -1 to return the current format, in this case returns -1 if failed.
When the format is changed in the dialog, for some formats the returned format is the preferred format, not the current format.
This will not affect color_mode of the capture image.
Returns zero if failed.

vc:SetFormat(format: number) -> error: number [in Lua 5] 

void IM_DECL imVideoCaptureGetImageSize imVideoCapture *  vc,
int *  width,
int *  height
 

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

vc:GetImageSize() -> width: number, height: number [in Lua 5] 

int IM_DECL imVideoCaptureSetImageSize imVideoCapture *  vc,
int  width,
int  height
 

Changes the image size of the connected device.
Similar to imVideoCaptureSetFormat, but changes only the size.
Valid sizes can be obtained with imVideoCaptureGetFormat.
Returns zero if failed.

vc:SetImageSize(width: number, height: number) -> error: number [in Lua 5] 

int IM_DECL 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.

vc:Frame(image: imImage, timeout: number) -> error: number [in Lua 5] 

int IM_DECL 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.

vc:OneFrame(image: imImage) -> error: number [in Lua 5] 

int IM_DECL imVideoCaptureLive imVideoCapture *  vc,
int  live
 

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

vc:Live(live: number) -> error: number [in Lua 5] 

int IM_DECL 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.

vc:ResetAttribute(attrib: string, fauto: number) -> error: number [in Lua 5] 

int IM_DECL 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 or attribute not supported.

vc:GetAttribute(attrib: string) -> error: number, percent: number [in Lua 5] 

int IM_DECL 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 or attribute not supported.

vc:SetAttribute(attrib: string, percent: number) -> error: number [in Lua 5] 

const char** IM_DECL imVideoCaptureGetAttributeList imVideoCapture *  vc,
int *  num_attrib
 

Returns a list of the description of the valid attributes for the device class.
But each device may still not support some of the returned attributes.
Use the return value of imVideoCaptureGetAttribute to check if the attribute is supported.

vc:GetAttributeList() -> attrib_list: table of strings [in Lua 5]