1. 程式人生 > >視訊監控專案中遇到的各種問題

視訊監控專案中遇到的各種問題

22 程式執行一段時間後程序異常退出OpenCV Error: Bad argument (Unknown array type) in cvarrToMat, file /home/src/OpenCV-2.3.1/modules/core/src/matrix.cpp, line 646
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/src/OpenCV-2.3.1/modules/core/src/matrix.cpp:646: error: (-5) Unknown array type in function cvarrToMat
Aborted
It appears you need to create your output matrix. In your example, change the declaration of Mc from CvMat to CvMat* and initialize it: CvMat *Mc = cvCreateMat( 2, 2, CV_32FC1); I think this will work. The compiler can't catch uninitialized array, since static type checking will pass