MIG Grabber SDK Manual 1.0
This is the manual for MIG Grabber SDK
Loading...
Searching...
No Matches
migGrabber.h File Reference
#include "MIG_ErrCode.h"
Include dependency graph for migGrabber.h:

Go to the source code of this file.

Classes

struct  _tagBOARD_INFO
 Board Info struct. More...
 
struct  _tagBOARD_LIST
 Board List struct. More...
 
struct  _tagMIG_VIDEO_CONF
 Video Config struct. More...
 
struct  _tagMIG_I2C_CONF
 I2C Config struct. More...
 

Macros

#define MIG_PARAM_VIDEO_FMT   1
 0:BAYER, 1:GRAY, 2:YUV422, 3:RGB16
 
#define MIG_PARAM_PIXEL_ORDER   2
 0:BGGR, 1:GBRG, 2:RGGB, 3:GRBG, / 0:YCBYCR;YUYV, 1:YCRYCB;YVYU, 2:CBYCRY;UYVY, 3:CRYCBY;VYUY
 
#define MIG_PARAM_HOR_RES   3
 Horizontal resolution (ex> 1920)
 
#define MIG_PARAM_VER_RES   4
 Vertical resolution (ex> 1080)
 
#define MIG_PARAM_BITS_PER_PIXEL   5
 bits per pixel (for internal image buffer and source)
 
#define MIG_PARAM_SRC_BITS_PER_PIXEL   6
 bits per pixel for source
 
#define MIG_PARAM_I2C_SLAVE_ADDR   11
 1byte data
 
#define MIG_PARAM_I2C_ADDR_TYPE_WORD   12
 0:byte Address, 1:word Address
 
#define MIG_PARAM_I2C_DATA_TYPE_WORD   13
 0:byte Data, 1:word Data
 
#define MIG_PARAM_I2C_CHECK_ACK   14
 Check Acknowledge.
 
#define MIG_PARAM_I2C_REPEAT_START   15
 Repeated Start Mode.
 
#define MIG_PARAM_I2C_SPEED_KHZ   16
 400: 400Khz
 
#define MIG_PARAM_BOARD_PRESET   61
 0: RESET / 1: ENABLE
 
#define MIG_PARAM_GPIO_1   71
 GPIO 1,2 output only / GPIO 3~7 bi-direction (0: low, 1: high)
 

Typedefs

typedef struct _tagBOARD_INFO _BOARD_INFO
 Board Info struct.
 
typedef struct _tagBOARD_LIST _BOARD_LIST
 Board List struct.
 
typedef struct _tagMIG_VIDEO_CONF _MIG_VIDEO_CONF
 Video Config struct.
 
typedef struct _tagMIG_I2C_CONF _MIG_I2C_CONF
 I2C Config struct.
 

Functions

int GetMigSdkVersion ()
 Get the version of MIG SDK.
 
int EnumerateBoard (_BOARD_LIST *pDest)
 Get the list of connected boards.
 
int GetNumOfBoard ()
 Get the number of connected boards.
 
int GetBoardId (int nUsbIndex)
 Get the board id by the usb index.
 
void GetErrStr (int nErrCode, char *pBuff, int sizeBuff)
 Get the error string.
 
int SetParamInt (int BoardId, int type, int val)
 Set the parameter.
 
int GetParamInt (int BoardId, int type)
 Get the parameter.
 
int OpenGrabber (int BoardId, int nGrabberType, MIG_HANDLE hwndParent)
 Open Grabber board.
 
void SetConfigPathName (int BoardId, const char *pConfigFilePath)
 Set the config path name.
 
int CloseGrabber (int BoardId)
 Close Grabber board.
 
BOOL IsGrabberOpened (int BoardId)
 Query that Grabber is opened.
 
int GetGrabberType (int BoardId)
 Get the Grabber Type.
 
int GetSerialNo (int BoardId, char *pSn, int sizeSN)
 Get the Serial Number.
 
BOOL IsVirtual (int BoardId)
 Query that Grabber is virtual mode.
 
int Grab (int BoardId, int nNbImage, DWORD dwTimeOut_ms)
 Captures the specified number of frames.
 
int GrabContinuous (int BoardId)
 Start capturing image.
 
BOOL GrabInProgress (int BoardId)
 Query that Grab is in progress.
 
int HaltGrab (int BoardId)
 Stop capturing image.
 
int WaitForFrameDone (int BoardId, DWORD dwTimeOut_ms)
 Wait for new frame.
 
int GetImage (int BoardId, unsigned char *pDstBuffer, int dstWidth, int dstHeight, int dstPitchBytes)
 Get image data.
 
int i2cRead (int BoardId, unsigned short wRegAddr, BYTE *pbytValue, int nLength)
 Read i2c data.
 
int i2cWrite (int BoardId, unsigned short wRegAddr, BYTE *pbytValue, int nLength)
 Write i2c data.
 
int bulk_i2cReset (int BoardId)
 Reset bulk i2c buffer data.
 
int bulk_i2cSet (int BoardId, unsigned short wRegAddr, BYTE *pbytValue, int nLength)
 Add i2c data into bulk buffer.
 
int bulk_i2cSetDelay (int BoardId, WORD wDelay_ms)
 Add delay data into bulk buffer.
 
int bulk_i2cRun (int BoardId)
 Execute bulk i2c buffer data.
 
int pwrSetVoltage (int BoardId, int nPwrChannel, const int nPwrLevel_mV)
 Power on the specified power channel.
 
int pwrMeasureVoltage (int BoardId, int nPwrChannel, int *pPwrResult_mV)
 Measure voltage on specified power channel.
 
int pwrMeasureCurrent (int BoardId, int nPwrChannel, int *pPwrResult_mA)
 Measure current on specified power channel.
 
int WriteRegisterSet (int BoardId, const char *pFile, const char *pSection, int *pnErrorIndex)
 Apply power or Sensor init configuration. ex> [POWERON] [REGISTER_INIT].
 
int ReadSyncCount (int BoardId, DWORD dwTimeOut_ms, int *pDestHsync, int *pDestVsync, ULONG *pDestPClk_Hz)
 Read sync count to check module output.
 

Detailed Description

Author
mason (conta.nosp@m.ct@c.nosp@m.izent.nosp@m.ech..nosp@m.com)
Version
0.1
Date
2025-02-07

Definition in file migGrabber.h.

Macro Definition Documentation

◆ MIG_PARAM_BITS_PER_PIXEL

#define MIG_PARAM_BITS_PER_PIXEL   5

bits per pixel (for internal image buffer and source)

Definition at line 22 of file migGrabber.h.

◆ MIG_PARAM_BOARD_PRESET

#define MIG_PARAM_BOARD_PRESET   61

0: RESET / 1: ENABLE

Definition at line 50 of file migGrabber.h.

◆ MIG_PARAM_GPIO_1

#define MIG_PARAM_GPIO_1   71

GPIO 1,2 output only / GPIO 3~7 bi-direction (0: low, 1: high)

Definition at line 56 of file migGrabber.h.

◆ MIG_PARAM_HOR_RES

#define MIG_PARAM_HOR_RES   3

Horizontal resolution (ex> 1920)

Definition at line 20 of file migGrabber.h.

◆ MIG_PARAM_I2C_ADDR_TYPE_WORD

#define MIG_PARAM_I2C_ADDR_TYPE_WORD   12

0:byte Address, 1:word Address

Definition at line 30 of file migGrabber.h.

◆ MIG_PARAM_I2C_CHECK_ACK

#define MIG_PARAM_I2C_CHECK_ACK   14

Check Acknowledge.

Definition at line 32 of file migGrabber.h.

◆ MIG_PARAM_I2C_DATA_TYPE_WORD

#define MIG_PARAM_I2C_DATA_TYPE_WORD   13

0:byte Data, 1:word Data

Definition at line 31 of file migGrabber.h.

◆ MIG_PARAM_I2C_REPEAT_START

#define MIG_PARAM_I2C_REPEAT_START   15

Repeated Start Mode.

Definition at line 33 of file migGrabber.h.

◆ MIG_PARAM_I2C_SLAVE_ADDR

#define MIG_PARAM_I2C_SLAVE_ADDR   11

1byte data

Definition at line 29 of file migGrabber.h.

◆ MIG_PARAM_I2C_SPEED_KHZ

#define MIG_PARAM_I2C_SPEED_KHZ   16

400: 400Khz

Definition at line 34 of file migGrabber.h.

◆ MIG_PARAM_PIXEL_ORDER

#define MIG_PARAM_PIXEL_ORDER   2

0:BGGR, 1:GBRG, 2:RGGB, 3:GRBG, / 0:YCBYCR;YUYV, 1:YCRYCB;YVYU, 2:CBYCRY;UYVY, 3:CRYCBY;VYUY

Definition at line 19 of file migGrabber.h.

◆ MIG_PARAM_SRC_BITS_PER_PIXEL

#define MIG_PARAM_SRC_BITS_PER_PIXEL   6

bits per pixel for source

Definition at line 23 of file migGrabber.h.

◆ MIG_PARAM_VER_RES

#define MIG_PARAM_VER_RES   4

Vertical resolution (ex> 1080)

Definition at line 21 of file migGrabber.h.

◆ MIG_PARAM_VIDEO_FMT

#define MIG_PARAM_VIDEO_FMT   1

0:BAYER, 1:GRAY, 2:YUV422, 3:RGB16

Definition at line 18 of file migGrabber.h.

Typedef Documentation

◆ _BOARD_INFO

typedef struct _tagBOARD_INFO _BOARD_INFO

Board Info struct.

◆ _BOARD_LIST

typedef struct _tagBOARD_LIST _BOARD_LIST

Board List struct.

See also
EnumerateBoard()

◆ _MIG_I2C_CONF

I2C Config struct.

◆ _MIG_VIDEO_CONF

Video Config struct.

Function Documentation

◆ bulk_i2cReset()

int bulk_i2cReset ( int BoardId)
extern

Reset bulk i2c buffer data.

Parameters
BoardIdID to control
Returns
MIG_OK
MIG_ERR

◆ bulk_i2cRun()

int bulk_i2cRun ( int BoardId)
extern

Execute bulk i2c buffer data.

Parameters
BoardIdID to control
Returns
MIG_OK
MIG_ERR

◆ bulk_i2cSet()

int bulk_i2cSet ( int BoardId,
unsigned short wRegAddr,
BYTE * pbytValue,
int nLength )
extern

Add i2c data into bulk buffer.

Parameters
BoardIdID to control
wRegAddrRegister address
pbytValueRegister data
nLengthdata length
Returns
MIG_OK
MIG_ERR

◆ bulk_i2cSetDelay()

int bulk_i2cSetDelay ( int BoardId,
WORD wDelay_ms )
extern

Add delay data into bulk buffer.

Parameters
BoardIdID to control
wDelay_ms
Returns
MIG_OK
MIG_ERR

◆ CloseGrabber()

int CloseGrabber ( int BoardId)
extern

Close Grabber board.

Parameters
BoardIdID to control
Returns
MIG_OK
MIG_ERR

◆ EnumerateBoard()

int EnumerateBoard ( _BOARD_LIST * pDest)
extern

Get the list of connected boards.

Parameters
pDest
Returns
MIG_OK
MIG_ERR
See also
_BOARD_LIST

◆ GetBoardId()

int GetBoardId ( int nUsbIndex)
extern

Get the board id by the usb index.

Parameters
nUsbIndexusb index
Returns
Board id : 0, 1, 2,, (-1: invalid usb index)

◆ GetErrStr()

void GetErrStr ( int nErrCode,
char * pBuff,
int sizeBuff )
extern

Get the error string.

Parameters
nErrCodeerror code
pBuffstring buffer to get result
sizeBuffbuffer size

◆ GetGrabberType()

int GetGrabberType ( int BoardId)
extern

Get the Grabber Type.

Parameters
BoardIdID to control
Returns
Grabber Type.

◆ GetImage()

int GetImage ( int BoardId,
unsigned char * pDstBuffer,
int dstWidth,
int dstHeight,
int dstPitchBytes )
extern

Get image data.

Parameters
BoardIdID to control
pDstBufferDestination buffer to get image data
dstWidthimage width
dstHeightimage height
dstPitchBytespitch bytes
Returns
MIG_OK
MIG_ERR

◆ GetMigSdkVersion()

int GetMigSdkVersion ( )
extern

Get the version of MIG SDK.

Returns
int

◆ GetNumOfBoard()

int GetNumOfBoard ( )
extern

Get the number of connected boards.

Returns
Gets the number of connected boards.

◆ GetParamInt()

int GetParamInt ( int BoardId,
int type )
extern

Get the parameter.

Parameters
BoardIdID to control
typeMIG_PARAM_VIDEO_FMT
Returns
parameter value

◆ GetSerialNo()

int GetSerialNo ( int BoardId,
char * pSn,
int sizeSN )
extern

Get the Serial Number.

Parameters
BoardIdID to control
pSnstring buffer to get SN
sizeSNbuffer size
Returns
MIG_OK
MIG_ERR
MIG_ERR_INTERFACE_NOT_IMPLEMENTED

◆ Grab()

int Grab ( int BoardId,
int nNbImage,
DWORD dwTimeOut_ms )
extern

Captures the specified number of frames.

Parameters
BoardIdID to control
nNbImagenumber of grab-image. normally that is 1. (over 1: average images)
dwTimeOut_mscommand timeout (millisecond)
Returns
MIG_OK
MIG_ERR_GRAB_IN_PROGRESS

◆ GrabContinuous()

int GrabContinuous ( int BoardId)
extern

Start capturing image.

Parameters
BoardIdID to control
Returns
MIG_OK
MIG_ERR_GRAB_IN_PROGRESS
See also
WaitForFrameDone()

◆ GrabInProgress()

BOOL GrabInProgress ( int BoardId)
extern

Query that Grab is in progress.

Parameters
BoardIdID to control
Returns
BOOL

◆ HaltGrab()

int HaltGrab ( int BoardId)
extern

Stop capturing image.

Parameters
BoardIdID to control
Returns
MIG_OK
MIG_ERR

◆ i2cRead()

int i2cRead ( int BoardId,
unsigned short wRegAddr,
BYTE * pbytValue,
int nLength )
extern

Read i2c data.

Parameters
BoardIdID to control
wRegAddrRegister address
pbytValueRegister read buffer
nLengthread length
Returns
MIG_OK
MIG_ERR

◆ i2cWrite()

int i2cWrite ( int BoardId,
unsigned short wRegAddr,
BYTE * pbytValue,
int nLength )
extern

Write i2c data.

Parameters
BoardIdID to control
wRegAddrRegister address
pbytValueRegister data
nLengthdata length
Returns
MIG_OK
See also
MIG_ERR_I2C_NO_ACK_DEV_ADDR

◆ IsGrabberOpened()

BOOL IsGrabberOpened ( int BoardId)
extern

Query that Grabber is opened.

Parameters
BoardIdID to control
Returns
TRUE. grabber is opened / FALSE

◆ IsVirtual()

BOOL IsVirtual ( int BoardId)
extern

Query that Grabber is virtual mode.

Parameters
BoardIdID to control
Returns
TRUE. sdk is virtual mode / FALSE

◆ OpenGrabber()

int OpenGrabber ( int BoardId,
int nGrabberType,
MIG_HANDLE hwndParent )
extern

Open Grabber board.

Parameters
BoardIdID to control
nGrabberType1:S2
hwndParenthandle of parent window (nullable)
Returns
MIG_OK
MIG_ERR

◆ pwrMeasureCurrent()

int pwrMeasureCurrent ( int BoardId,
int nPwrChannel,
int * pPwrResult_mA )
extern

Measure current on specified power channel.

Parameters
BoardIdID to control
nPwrChannelpower channel 0, 1, 2,,,
pPwrResult_mA
Returns
MIG_OK
MIG_ERR

◆ pwrMeasureVoltage()

int pwrMeasureVoltage ( int BoardId,
int nPwrChannel,
int * pPwrResult_mV )
extern

Measure voltage on specified power channel.

Parameters
BoardIdID to control
nPwrChannelpower channel 0, 1, 2,,,
pPwrResult_mV
Returns
MIG_OK
MIG_ERR

◆ pwrSetVoltage()

int pwrSetVoltage ( int BoardId,
int nPwrChannel,
const int nPwrLevel_mV )
extern

Power on the specified power channel.

Parameters
BoardIdID to control
nPwrChannelpower channel 0, 1, 2,,,
nPwrLevel_mVpower level (mili voltage)
Returns
MIG_OK
MIG_ERR

◆ ReadSyncCount()

int ReadSyncCount ( int BoardId,
DWORD dwTimeOut_ms,
int * pDestHsync,
int * pDestVsync,
ULONG * pDestPClk_Hz )
extern

Read sync count to check module output.

Parameters
BoardIdID to control
dwTimeOut_mstimeout for waiting valid sync
pDestHsynccount of Horizontal sync
pDestVsynccount of Vertical sync
pDestPClk_Hzcount of PCLK
Returns
MIG_OK
MIG_ERR_TIMEOUT_READSYNC

◆ SetConfigPathName()

void SetConfigPathName ( int BoardId,
const char * pConfigFilePath )
extern

Set the config path name.

Parameters
BoardIdID to control
pConfigFilePathconfig path

◆ SetParamInt()

int SetParamInt ( int BoardId,
int type,
int val )
extern

Set the parameter.

Parameters
BoardIdID to control
typeMIG_PARAM_VIDEO_FMT
valparameter value
Returns
MIG_OK
MIG_ERR_INVALID_PARAMETER
MIG_ERR_GRABBER_NOT_OPENED

◆ WaitForFrameDone()

int WaitForFrameDone ( int BoardId,
DWORD dwTimeOut_ms )
extern

Wait for new frame.

Parameters
BoardIdID to control
dwTimeOut_mstimeout for waiting new frame (millisecond)
Returns
MIG_OK
MIG_ERR_GRAB_TIMEOUT
See also
GrabContinuous()

◆ WriteRegisterSet()

int WriteRegisterSet ( int BoardId,
const char * pFile,
const char * pSection,
int * pnErrorIndex )
extern

Apply power or Sensor init configuration. ex> [POWERON] [REGISTER_INIT].

Parameters
BoardIdID to control
pFilefile name of sensor init
pSectionsection name of sensor init
pnErrorIndexif error, error line number
Returns
MIG_OK
MIG_ERR_EMPTY_REGISTER_SET
MIG_ERR_I2C_NO_ACK_DEV_ADDR
MIG_ERR_INVALID_COMMAND