Streaming from iDS to OpenCV

562 views Asked by At

Is it possible, to take images from iDS camera and convert them to OpenCV recognizable format?

I have followed code for stream data over rtsp:// from iDS:

/* allocate image buffer */
char *pMemoryBuffer;
int nMemoryId;
nRet = is_AllocImageMem(hCam, rectAoi.s32Width, rectAoi.s32Height, 24, &pMemoryBuffer, &nMemoryId);
abortOnError(nRet, "Allocating image memory failed with error code: ");

/* set allocated image buffer active */
nRet = is_SetImageMem(hCam, pMemoryBuffer, nMemoryId);
abortOnError(nRet, "Setting image memory active failed with error code: ");
/* capture a single frame */
nRet = is_FreezeVideo(hCam, IS_WAIT);

/* Step 4: Submit frame data to the stream */
IS_STREAM_PAYLOAD_DATA data;
data.cbSizeOfStruct = sizeof(IS_STREAM_PAYLOAD_DATA);
data.pData = reinterpret_cast<unsigned char*>(pMemoryBuffer);
data.cbSizeOfData = rectAoi.s32Width * rectAoi.s32Height * 3;
data.idSession = sessionInfo.idSession;
data.idStream = streamInfo.idStream;

But I need to get OpenCV (IplImage/Mat) image directly, or image in any other known format.

1

There are 1 answers

2
Olga Pshenichnikova On

OK, so it is possible to do it via File System:

memset(&ImageFileParams, 0, sizeof(ImageFileParams));
ImageFileParams.pwchFileName = myString;
ImageFileParams.pnImageID = NULL;
ImageFileParams.ppcImageMem = NULL;
ImageFileParams.nQuality = 0;

nRet = is_ImageFile(hCam, IS_IMAGE_FILE_CMD_SAVE, (void*)&ImageFileParams, sizeof(ImageFileParams));