81 / 179
Copyright © 2017 TOSHIBA TELI CORPORATION, All rights reserved.
http://www.toshiba-teli.co.jp/en/
D4267042B
2. Open and Start image stream.
To start and stop capturing image is the same way as AcquisitionControl.
Please refer to AcquisitionControl section as well.
3. Read the number of frames in Image Buffer by
‘ImageBufferFrameCount’.
4. Read Image from Image Buffer by
‘ImageBufferRead’.
5. Receive Image from Image Buffer.
6. Stop and Close image stream.
// GenICam node handle
CAM_NODE_HANDLE hMode = NULL;
CAM_NODE_HANDLE hCount = NULL;
CAM_NODE_HANDLE hRead = NULL;
// Retrieve GenICam node.
Nd_GetNode(s_hCam, "ImageBufferMode", &hMode);
Nd_GetNode(s_hCam, "ImageBufferFrameCount", &hCount);
Nd_GetNode(s_hCam, "ImageBufferRead", &hRead);
// 1.Select an Image Buffer mode
Nd_SetEnumStrValue(s_hCam, hMode, "On");
// 2.Open and Start image stream.
// 2.1.Set Trigger mode
SetCamTriggerMode(s_hCam, true);
SetCamTriggerSource(s_hCam, CAM_TRIGGER_SOFTWARE);
// 2.2.Open Stream
s_hStrmEvt = CreateEvent(NULL, FALSE, FALSE, NULL);
Strm_OpenSimple(s_hCam, &s_hStrm, &s_uiImgBufSize, s_hStrmEvt);
s_pucImgBuf = (uint8_t *)VirtualAlloc(NULL, s_uiImgBufSize, MEM_RESERVE
| MEM_COMMIT, PAGE_EXECUTE_READWRITE);
// 2.3.Stream Start
Strm_Start(s_hStrm);
// 2.4.Execute Software Trigger
ExecuteCamSoftwareTrigger(s_hCam);
// 3.Read the number of frames in Image Buffer by 'ImageBufferFrameCount'.
int64_t count = 0;
while(count==0)
{
Nd_GetIntValue(s_hCam, hCount, &count);
}
// 4.Read Image from Image Buffer by 'ImageBufferRead'.
Nd_CmdExecute(s_hCam, hRead);
// 5.Receive Image from Image Buffer
uint32_t uiSize = s_uiImgBufSize;
WaitForSingleObject(s_hStrmEvt, 1000);
Strm_ReadCurrentImage(s_hStrm, s_pucImgBuf, &uiSize, NULL);
// 6.Stop and Close image stream.
// 6.1.Stream Stop
Strm_Stop(s_hStrm);
// 6.2.Close Stream
Strm_Close(s_hStrm);
CloseHandle(s_hStrmEvt);
VirtualFree(s_pucImgBuf, 0, MEM_RELEASE);