Machine Vision Camera SDK (C) Developer Guide
Note
Before starting the acquisition, you can call MV_CC_SetImageNodeNum to set the number of
image buffer nodes. When the number of obtained images is larger than this number, the
earliest image data will be discarded automatically.
For original image data, you can call MV_CC_ConvertPixelType to convert the image pixel
format, or you can call MV_CC_SaveImageEx2 to convert the image to JPEG or BMP format
and save as a file.
6. Perform one of the following operations to acquire images.
- Call MV_CC_GetOneFrameTimeout repeatedly in the application layer to get the frame data
with specified pixel format.
- Call MV_CC_GetImageBuffer in the application layer to get the frame data with specified pixel
format and call MV_CC_FreeImageBuffer to release the buffer.
Note
When getting the frame data, the application program should control the frequency of calling
this API according to the frame rate.
The differences of above two image acquisition methods are:
MV_CC_GetImageBuffer should be used with MV_CC_FreeImageBuffer in pairs, the data
pointer of pstFrame should be released by MV_CC_FreeImageBuffer .
Compared with MV_CC_GetOneFrameTimeout , MV_CC_GetImageBuffer is more efficient,
and its stream buffer is allocated by SDK, while the stream buffer of
MV_CC_GetOneFrameTimeout should allocated by the developer.
The above two methods and the method of acquiring image in callback function cannot be
used at the same time.
The pData returns an address pointer, it is recommended to copy the data of pData to create
another thread.
7. Optional: Call MV_CC_DisplayOneFrame to input the window handle and start displaying.
8. Call MV_CC_StopGrabbing to stop the acquisition or stop displaying.
9. Call MV_CC_CloseDevice to close the device.
10. Call MV_CC_DestroyHandle to destroy the handle and release resources.
3.2 Get Image in Callback Function
The API MV_CC_RegisterImageCallBackEx is provided for registering callback function. You can
customize the callback function and the obtained image will automatically called back. This
method can simplify the application logic.
14
    "