sunfounder / SunFounder_PiCar-V

Smart Video Car Kit V2.0 for Raspberry Pi from SunFounder
GNU General Public License v2.0
111 stars 175 forks source link

Ball tracker not working #82

Closed H-Sf closed 2 years ago

H-Sf commented 2 years ago

Hello,

I was trying to run the red ball tracker program and I am getting this error :

OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp, line 9815 Traceback (most recent call last): File "ball_tracker.py", line 257, in <module> main() File "ball_tracker.py", line 97, in main (tmp_x, tmp_y), tmp_r = find_blob() File "ball_tracker.py", line 205, in find_blob hsv_image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2HSV) cv2.error: /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp:9815: error: (-215) (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) in function cvtColor

Does anyone have an idea on how to fix this problem.

Thank you in advance for your help.

H-Sf commented 2 years ago

In fact, I had some problems with the OPENCV package and I had to install it using the sudo apt-get install instead of sudo pip3 install as mentioned in this link. Thanks!