Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VideoCapture from unsupported API

I have two cameras which have their own API which isn’t supported amongst the VideoCaptureAPIs.These cameras do not register as cameras either so they cannot be called up using a camera number as you would with a usb webcam. The cameras api writes the video data to an unsigned char and you can loop the capture sequence to get the data. I was wondering if there was a way to get a live video stream using the data stored in the char. Below is the description from the cameras API.

Descriptions:

get data from the video buffer.the buffer is very small

you need to call this API as fast as possible, otherwise frame will be discarded

so the best way is maintain one buffer loop and call this API in a loop

please make sure the buffer size is biger enough to hold one image

otherwise the this API will crash

Paras:

int CameraID: this is get from the camera property use the API ASIGetCameraProperty

unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough

    the size in byte:

    8bit mono:width*height

    16bit mono:width*height*2

    RGB24:width*height*3

int iWaitms, this API will block and wait iWaitms to get one image. the unit is ms -1 means wait forever. this value is recommend set to exposure*2+500ms return:

ASI_SUCCESS : Operation is successful

ASI_ERROR_CAMERA_CLOSED : camera didn't open

ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary

ASI_ERROR_TIMEOUT: no image get and timeout

*************************/

ASICAMERA_API ASI_ERROR_CODE ASIGetVideoData(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms);

/*************************