-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I believe it could be defined at runtime with a PV with no considerable performance costs or complexity added to the code.
For now what we have is:
#define MIN_DELAY 1e-5
#define USE_COPYFRAME 1 // 0: call dcambuf_lockframe to access image, 1: call dcambuf_copyframe to access image
#define OUTPUT_IMAGE 0 // 0: not output, 1: output the accessed image by raw data
(...)
#if USE_COPYFRAME
// set user buffer information and copied ROI
bufframe.buf = buf;
bufframe.rowbytes = rowbytes;
bufframe.left = ox;
bufframe.top = oy;
bufframe.width = cx;
bufframe.height = cy;
// access image
err = dcambuf_copyframe( hdcam, &bufframe );
if ( checkErrAndPrint(__FUNCTION__, err, "dcambuf_copyframe()") )
return FALSE;
#else
// access image
err = dcambuf_lockframe( hdcam, &bufframe );
if ( checkErrAndPrint(__FUNCTION__, err, "dcambuf_lockframe()") )
return FALSE;
if( bufframe.type != DCAM_PIXELTYPE_MONO16 )
{
printf( "not implement pixel type\n" );
return FALSE;
}
// copy target ROI
int32 copyrowbytes = cx * 2;
char* pSrc = (char*)bufframe.buf + oy * bufframe.rowbytes + ox * 2;
char* pDst = (char*)buf;
int y;
for( y = 0; y < cy; y++ )
{
memcpy_s( pDst, rowbytes, pSrc, copyrowbytes );
pSrc += bufframe.rowbytes;
pDst += rowbytes;
}
#endif
Metadata
Metadata
Assignees
Labels
No labels