OpenCV:Matrix错误消息“函数cvarrToMat中的未知数组类型”,而不使用矩阵

时间:2012-08-26 11:35:17

标签: exception opencv image-scaling

虽然我不使用矩阵,但在捕获和缩放图像数据时,我从OpenCV获得了与矩阵相关的错误消息/异常。那是我目前的代码:

if (data->capture->grab()) // capture something from already opened device
{
    if (data->capture->retrieve(grabFrame,0)) // get the frame
    {
        CvSize size;

        size.width=data->config.width;
        size.height=data->config.height;
        nextFrame=cvCreateImage(size,32,0);
        resFrame=cvCreateImage(size,32,0); // predefined default sizes to scale the image to...
        if ((nextFrame) && (resFrame))
        {
            cvResize(&grabFrame,nextFrame,cv::INTER_AREA); // scale the image to the predefined size

--> here the Exception is thrown!

            cvCvtColor(nextFrame,resFrame,CV_BGR2RGB);
            ...
        }
        if (nextFrame) cvReleaseImage(&nextFrame);
    }
}

OpenCV的确切输出是:

  

OpenCV错误:cvarrToMat中的错误参数(未知数组类型),file / builddir / build / BUILD /> OpenCV-2.3.1 / modules / core / src / matrix.cpp,第646行   在抛出'cv :: Exception'的实例后终止调用     what():/ builddir/build/BUILD/OpenCV-2.3.1/modules/core/src/matrix.cpp:646:错误:( - 5)函数cvarrToMat中的未知数组类型

     

中止

那么我在愚蠢而简单的缩放操作中做错了什么呢?

谢谢!

1 个答案:

答案 0 :(得分:0)

解决:我需要使用cvQueryFrame()来获取格式正确的帧。