Giter Site home page Giter Site logo

Comments (9)

surya-veer avatar surya-veer commented on June 16, 2024 4

Since your camera is not capturing video and returning None which is raising an exception in typecast.
You need to set the correct camera path to resolve this.

LINUX/MAC:
run this in your console ls -ltrh /dev/video*
it will show you the list of video device in your computer like /dev/video0
then replace line 67: video_capture = cv2.VideoCapture(-1) to video_capture = cv2.VideoCapture('dev/video0')

WINDOWS:
Run this following camera code and check available device id and use that in cv2.VideoCapture(id)

cams_test = 10
for id in range(0, cams_test): //if you don't find it please check your camera if it is working or not
    cap = cv2.VideoCapture(id)
    test, frame = cap.read()
    if test:
        print("id : "+str(id)+" /// result: "+str(test))
    cap.release()

from movement-tracking.

eftanzer avatar eftanzer commented on June 16, 2024 1

I was having similar issues and the solutions above did not resolve this alone. In order to get this to work, I needed to install opencv-python-headless instead of opencv-python and change the -1 to 1. Sharing here in case others run into the same thing.

from movement-tracking.

surya-veer avatar surya-veer commented on June 16, 2024

Unable to get camera on -1
Go to line 67
video_capture = cv2.VideoCapture(-1)
try to change -1 to 0 or 1
it will work for you

from movement-tracking.

gaurav45 avatar gaurav45 commented on June 16, 2024

Hii,
I tried to run your script its giving error. Can you please tell how to fix . I am new to python.
ERROR
Traceback (most recent call last):
File "F:\movement-tracking-master\movement-v2.py", line 83, in
img, nose_cords = detect_nose(img, faceCascade)
File "F:\movement-tracking-master\movement-v2.py", line 11, in detect_nose
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Thanks In Advance

from movement-tracking.

cbhushan051 avatar cbhushan051 commented on June 16, 2024

Since your camera is not capturing video and returning None which is raising an exception in typecast.
You need to set the correct camera path to resolve this.

LINUX/MAC:
run this in your console ls -ltrh /dev/video*
it will show you the list of video device in your computer like /dev/video0
then replace line 67: video_capture = cv2.VideoCapture(-1) to video_capture = cv2.VideoCapture('dev/video0')

WINDOWS:
Run this following camera code and check available device id and use that in cv2.VideoCapture(id)

cams_test = 10
for id in range(0, cams_test): //if you don't find it please check your camera if it is working or not
    cap = cv2.VideoCapture(id)
    test, frame = cap.read()
    if test:
        print("id : "+str(id)+" /// result: "+str(test))
    cap.release()

try 0 as argument... In linux it take 0 for webcam

from movement-tracking.

sahilcool321 avatar sahilcool321 commented on June 16, 2024

from movement-tracking.

Hasnainajmal avatar Hasnainajmal commented on June 16, 2024

C:\Users\Dell\Desktop\new web\movement-tracking-master>movement-v1.py
Traceback (most recent call last):
File "C:\Users\Dell\Desktop\new web\movement-tracking-master\movement-v1.py", line 78, in
img, nose_cords = detect_nose(img, faceCascade)
File "C:\Users\Dell\Desktop\new web\movement-tracking-master\movement-v1.py", line 10, in detect_nose
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

I am facing this problem please help

from movement-tracking.

surya-veer avatar surya-veer commented on June 16, 2024

@Hasnainajmal #4 (comment)

from movement-tracking.

gaurav45 avatar gaurav45 commented on June 16, 2024

from movement-tracking.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.