3
我的應用程序保持與此錯誤的Android - opencv的 - 錯誤:(-215)U在函數void CV = 0 ::墊::創建
FATAL EXCEPTION: Thread-22883
Process: com.aar.Cline, PID: 7270
CvException [org.opencv.core.CvException: cv::Exception: /Volumes/Linux/builds/master_pack-android/opencv/modules/core/src/matrix.cpp:424: error: (-215) u != 0 in function void cv::Mat::create(int, const int*, int)
]
at org.opencv.imgproc.Imgproc.cvtColor_1(Native Method)
at org.opencv.imgproc.Imgproc.cvtColor(Imgproc.java:1724)
at com.aar.Cline.TrackBallActivity.detectBall(TrackBallActivity.java:592)
at com.aar.Cline.TrackBallActivity.onCameraFrame(TrackBallActivity.java:190)
at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:391)
at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:350)
at java.lang.Thread.run(Thread.java:818)
的應用程序運行良好約3分鐘崩潰當突然在中間這個錯誤顯示在這裏是它不斷崩潰的線
Mat grayImage1 = new Mat();
Imgproc.cvtColor(frame1, grayImage1, Imgproc.COLOR_BGR2GRAY);
有什麼建議嗎?
錯誤發生[這裏](HTTPS ://github.com/Itseez/opencv/blob/master/modules/core/src/matrix.cpp#L426)。這意味着你不能分配足夠的內存。你基本上沒有記憶。不要每次都創建新的矩陣,最好將它們分配一次(作爲類成員)並重用它們。 – Miki