0

是否可以从 iDS 相机拍摄图像并将其转换为 OpenCV 可识别的格式?

我遵循了rtsp://来自 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;

但我需要直接获取 OpenCV (IplImage/Mat) 图像,或任何其他已知格式的图像。

4

1 回答 1

0

好的,所以可以通过文件系统来做到这一点:

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));
于 2019-03-25T11:37:48.677 回答