Snake Game using Opencv Python + 3080 Ti Giveaway - playproduction.de

Snake Game using Opencv Python + 3080 Ti Giveaway

Murtaza’s Workshop – Robotics and AI
Views: 255482
Like: 2427
✅ Step 1: Register for NVIDIA GTC using this link:
✅ Step 2: Wait for the GTC to start and join the Keynote Livestream.
✅ Step 3: Attend GTC sessions and win the 3080 Ti.

In this video, we will create the classic snake game using computer vision. We will use our index fingers to move the snake and eat the food generated at random locations.

Download Code and Files:

Premium Courses:
✔️ Computer Vision Game Development Course:

✔️ Computer Vision with Arduino Course:

✔️ Advanced Drone Programming Course:

✔️ Learn to Build Computer Vision Mobile Apps:

✔️ Jetson Nano Premium Course:

Follow Me:
TikTok:
Facebook Group:
Discord:
Facebook Page:
Instagram :
Website:
Github:

Product Links:
Recommend Webcam for Computer Vision:
Budget Webcam:
Computer Vision Robot Arm :
Cheap Drone for OpenCV:
DC Motors + Wheels + Chassis:
DC Motors + Wheels:
Arduino UNO:
Motor Driver:
Battery:
Raspberry Pi 4 Best Starter Kit:
Raspberry Pi Recommended Battery:

My Setup:
Mouse:
Mechanical Keyboard:
Normal Keyboard:
GPU:
CPU:
SSD:
MIC:
Camera:
3D Printer:
Sim Race:

#ComputerVision
#OpenCV
#CVZone

85 Comments

  1. Sir I have also one idea for new game project

    i think you have also make a project on apply physics on image in computer vision.

    so basically idea is to make a simple fruit ninja game to combining the physics and hand gestures. I can try it but it is not working properly if like this project idea then please make a video on it and please give me reply sir ☺

  2. Please make a video on sign language detection in python

  3. sorry. I have trouble when following your tutorial ( Snake Game using OpenCV Python)

    Traceback (most recent call last):

    File "C:UsersADMINPycharmProjectssnakeGameCVtestCV.py", line 49, in <module>

    hands, img = detector.findHands(img, flipType=False)

    File "C:UsersADMINPycharmProjectssnakeGameCVvenvlibsite-packagescvzoneHandTrackingModule.py", line 48, in findHands

    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    cv2.error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

    please help me?
    thank you.

  4. not working

    File "C:Usersb_b_hDesktopVisondeneme.py", line 25, in <module>

    hacv2 = detector.findHands(img)

    File "C:Usersb_b_hanaconda3libsite-packagescvzoneHandTrackingModule.py", line 48, in findHands

    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

  5. who is here watching his ai virtual painter by tones of code and here he just do it in 15 – 16 lines of code 😂😂

  6. Traceback (most recent call last):

    File "C:UsersSHUBHAMDesktopgamessnake gamesnake_game.py", line 107, in <module>

    hands, img = detector.findHands(img, flipType=True)

    File "C:UsersSHUBHAMAppDataLocalProgramsPythonPython39libsite-packagescvzoneHandTrackingModule.py", line 47, in findHands

    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    cv2.error: OpenCV(4.5.3) C:UsersrunneradminAppDataLocalTemppip-req-build-sn_xpupmopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

    got these errors 🙁

  7. error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

  8. ValueError: could not broadcast input array from shape (75,75,3) into shape (75,58,3)

  9. Murtaza bhai aik project face moving detection pr bhi bana dyien

  10. ValueError: could not broadcast input array from shape (75,75,3) into shape (75,58,3)

  11. ValueError: could not broadcast input array from shape (75,75,3) into shape (75,58,3)

  12. ValueError: could not broadcast input array from shape (75,75,3) into shape (75,58,3)

  13. ValueError: could not broadcast input array from shape (75,75,3) into shape (75,58,3)

  14. pls ans i have an project that I need to sub mit this pls plz help me anyone

  15. मसीह यीशु पापियों का उद्धार करने के लिये जगत में आया . . . (1 तीमुथियुस 1:15)

     सब ने पाप किया है और परमेश्‍वर की महिमा* से रहित है, ( रोमियों 3:23)

     . . . परमेश्‍वर ने जगत से ऐसा प्रेम रखा कि उसने अपना एकलौता पुत्र दे दिया, ताकि जो कोई उस पर विश्वास करे, वह नाश न हो, परन्तु अनन्त जीवन पाए। (यूहन्ना 3:16)

    “क्योंकि पाप की मजदूरी* तो मृत्यु है, परन्तु परमेश्‍वर का वरदान हमारे प्रभु मसीह यीशु में अनन्त जीवन है।” (रोमियों 6:23)

    यदि तू अपने मुँह से यीशु को प्रभु जानकर अंगीकार करे और अपने मन से विश्वास करे, कि परमेश्‍वर ने उसे मरे हुओं में से जिलाया, तो तू निश्चय उद्धार पाएगा। (रोमियों 10:9)

  16. Hi, thanks for your tutorial! Does it works with normal webcams like in a laptop ?

  17. Thanks a lot for creating such amazing content

  18. I am facing an error while opening camera I had look each step but get se error can anyone help me

  19. error:—
    cv2.error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
    while i was trying to open camera as u said sir.

  20. Thank you sir! I always learn a lot from your tutorials! For this game project, I wonder if I can present different images after each hit. TIA!

  21. Hey…. What a wonderful video!!
    I am facing a problem can someone help me out?
    After the adding the code for drawing donut. I am facing a value error saying that 'could not broadcast input array from shape(75,75,3) into shape(0,0,3). Anyone knows what i am doing wrong? Please help

  22. your program awesome Mr…… 🙂 🙂 , but i have error…. Mr. Murtaza or anybody can tell me the error : E:PythonpycharmularScriptspython.exe E:/Python/pycharm/ular/ular.py

    Traceback (most recent call last):

    File "E:Pythonpycharmularular.py", line 107, in <module>

    hands, img = detector.findHands(img, flipType=False)

    File "E:Pythonpycharmularlibsite-packagescvzoneHandTrackingModule.py", line 48, in findHands

    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    cv2.error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

    INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

    Process finished with exit code 1

  23. this is so addictive, with all respect and much love from myanmar, I will be supporting you sir forever

  24. File "C:UsersVIKASHPycharmProjectsmain.py", line 100, in <module>

    game = SnakeGameClass("Jpp.png")

    TypeError: SnakeGameClass() takes no arguments

  25. CHITUS💖⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ says:

    Thank you sir! I always learn a lot from your tutorials! For this game project, I wonder if I can present different images after each hit. TIA!

  26. AttributeError: module 'cvzone' has no attribute 'putTextRect' just installed the cvzone to python3 with command; pip3 install cvzone, how to fix?

  27. Projects like these = instant likes, shares and subscribes.
    🔥🔥

  28. All good, but the jittery detection causes a "Game Over" nearly seconds in.
    I think it's the collision tolerance.
    Anyone gets the same problem?

  29. Hi poeple ; The code works perfectly but I have two problems here ; The game stops when I eat 1donuts, Then the size of the image is too small and I try to solve this problem but I don't see where it could be.. Whoever has an idea, that would be nice of him ^^ thanking you

  30. I've been trying to run the doe but this error keeps on coming back:

    File "C:UserssriarDesktopSnake Gamemain.py", line 107, in <module>

    hands, img = detector.findHands(img, flipType=False)

    File "C:UserssriarDesktopSnake Gamevenvlibsite-packagescvzoneHandTrackingModule.py", line 48, in findHands

    imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    cv2.error: OpenCV(4.5.5) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

    If anyone can help me then it'd be a great help.

  31. i NEED CLARIFICATION….sorry for the caps…i dont understand this and im sorry if im dumb about that. Is there a difference (i think it must be huge) between cvzone and opencv?? whhy not the dependency opencv-python, and instead you are using cvzone? im sorry i just dont understand the difference in terms of why use one vs the other. can I accomplish the same using opencv? confusion…anyone??? Can anyone explain in brief words? a big thank you !!

  32. I now you are a business man, A busy guy. I even bought your courses. But the problem is…there is no support. There are videos that you did, that sopmeone like me tries to work on it, and learn and they no longer work because they are outdated. I mean c'mon..at least troubleshoot your questions here, my friend…

  33. AttributeError: 'SnakeGameClass' object has no attribute 'previousHead'

    sir plz help,,,…

  34. Perfect Tutorial ! , Thank you so much , big like to your video <3

  35. i don't get your ai app do you creat how to solve errors

  36. Worked great, thanks!

    Just that I am having a small issue which is when the snake is too big the colision seems to not work anymore sometimes.

    And a small contribution for the people reading the comments:

    At the end you can see that even if you start a new game, the score starts from where it stops. To fix this, just add game.score = 0 at the very end of the code.

    if key == ord('r'):
    game.gameOver = False
    game.score = 0

  37. hello sir!!!!!!!!!!!!
    plz. help out!!
    I am facing a value error saying that 'could not broadcast input array from shape(75,75,3) into shape(0,0,3). Anyone knows what i am doing wrong? Please help!!!!!

Leave a Reply

Your email address will not be published.