【问题标题】:Streaming from iDS to OpenCV从 iDS 流式传输到 OpenCV
【发布时间】:2019-03-22 16:19:10
【问题描述】:

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

我已经关注了来自 iDS 的 rtsp:// 上的流数据代码:

/* 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) 图像,或任何其他已知格式的图像。

【问题讨论】:

    标签: c++ image opencv ueye


    【解决方案1】:

    好的,所以可以通过文件系统来完成:

    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));
    

    【讨论】:

    • 这段代码只是使用 IDS API 保存图像。您能否解释一下——转换为 CV 的实际发生在哪里?
    • 很久以前...我猜它发生在持久化函数本身,但我真的不记得了。
    猜你喜欢
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 2019-10-16
    • 2018-01-06
    • 2021-10-03
    • 2017-12-07
    • 2019-06-10
    相关资源
    最近更新 更多