簡體   English   中英

OpenCV 2.2:未知 function 中的錯誤參數,文件..\..\..\..\ocv\opencv\modules\core\src\array.cpp

[英]OpenCV 2.2: bad argument in unknown function, file ..\..\..\..\ocv\opencv\modules\core\src\array.cpp

當我嘗試編譯我的代碼時出現上述錯誤。 它是一個非常非常非常簡單的 function,我不知道為什么我有這個問題。 最糟糕的是,我什至找不到 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*************************************/
}

文檔中說明cvQueryFrame返回的圖像不必發布。 在你的情況下刪除

cvReleaseImage(&frame);

frame的解除/分配由捕獲設備內部管理。

希望有幫助!

編輯:如果您想進一步處理您的圖像,請使用cvCopy(frame, yourManagedImage); , 並使用yourManagedImage而不是原始frame

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM