【问题标题】:OpenCV 2.2: bad argument in unknown function, file ..\..\..\..\ocv\opencv\modules\core\src\array.cppOpenCV 2.2:未知函数中的错误参数,文件 ..\..\..\..\ocv\opencv\modules\core\src\array.cpp
【发布时间】:2011-09-28 13:49:22
【问题描述】:

当我尝试编译我的代码时出现上述错误。它是一个非常非常非常简单的功能,我无法弄清楚为什么会出现问题。最糟糕的是,我什至找不到 array.cpp 在 opencv 文件夹中的位置,所以我看不出有什么问题。有人知道吗?请帮忙!

int imgreg_capture_image()
{
    /*********************Try capturing an image from the camera first*************************************/

    CvCapture* imgregCapture = cvCaptureFromCAM( CV_CAP_ANY );
   if ( !imgregCapture ) {
     fprintf( stderr, "ERROR: capture is NULL \n" );

     exit(-1);
   }

     // Get one frame
     IplImage* frame = 0;
     frame = cvQueryFrame(imgregCapture);
     if ( !frame ) {
       fprintf( stderr, "ERROR: frame is null...\n" );
       return -1;
     }

   //save the image into a file
    cvSaveImage( CAPTURE_FILE, frame );

   // Release the capture device housekeeping

    cvReleaseCapture(&imgregCapture);

    cvReleaseImage(&frame);

   return 0;
   /***************Finish Try capturing an image from the camera first*************************************/
}

【问题讨论】:

  • array.cpp 文件位于modules/core/src/array.cpp。如果您提供有关您得到的错误的更多详细信息可能会有所帮助-您可以发布编译器的完整输出吗?您能否还指出哪些行号是指您发布的代码中的哪些行?

标签: c++ c opencv camera


【解决方案1】:

stated in the documentationcvQueryFrame返回的图片不必发布。在你的情况下删除

cvReleaseImage(&frame);

frame 的解除/分配由捕获设备内部管理。

希望有帮助!

编辑:如果您希望进一步处理您的图像,请使用cvCopy(frame, yourManagedImage);,并使用yourManagedImage 而不是原来的frame

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-08
    • 2014-01-16
    • 2019-09-25
    • 2020-04-22
    • 2016-08-10
    • 2020-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多