I've followed this tutorial of OpenCV object tracking and managed to make the code work on my laptop, both on Windows using Visual Studio and on my Ubuntu VM (Using CMake). Now I try to run it on my Raspberry Pi (running Raspbian). cmake .
and make
commands seems to works fine but when I try to run the executable I get the following error:
pi@raspberrypi ~/Desktop/Track $ ./TrackObj
init done
opengl support available
OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /home/pi/opencv-2.4.10/modules/imgproc/src/color.cpp, line 3961
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pi/opencv-2.4.10/modules/imgproc/src/color.cpp:3961: error: (-215) (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) in function cvtColor
Aborted
I've looked at this question and similar to it but it did not help me solve the problem.
Source code available here:
I've heard that the problem might be with the camera or camera drivers so I tried using a usb camera as well as the pi camera and I also tried to change the line capture.open(0);
to capture.open("someMovie.mp4");
so instead of open a live stream it will run in on an exiting video but it still giving me the same error.