OpenCV Error: approval failed (scn == 3 || scn == 4) on Raspberry Pi

I followed this OpenCV object tracking tutorial and managed to get the code to work on my laptop, both on Windows using Visual Studio and on my Ubuntu VM (using CMake). Now I'm trying to run it on my Raspberry Pi (Raspbian works). The commands cmake .and makework 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 reviewed this question and looked like it, but it did not help me solve the problem.

Source code is available here:

objectTrackingTutorial.cpp

Fruit.cpp

Fruit.h

, , USB-, -, capture.open(0); capture.open("someMovie.mp4");, , - .

+4
1

, , 'cvtColor()', , . :

  • .

CV_BGR2HSV CV_RGB2HSV , , , . , .

+4

All Articles