Ask Your Question

Revision history [back]

what does this error message means?

hello. Im trying to make a face detection from live video feed using haar cascade by using this code

import cv2 import sys

faceCascade = cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml')

video_capture = cv2.VideoCapture(0)

while True: ret, frame = video_capture.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale( gray, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30), flags=cv2.CASCADE_SCALE_IMAGE )

for (x, y, w, h) in faces:
    cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)


cv2.imshow('Video', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

video_capture.release() cv2.destroyAllWindows()

but then I got this error message

Traceback (most recent call last): File "/home/pi/pythonpy/videofacedet.py", line 17, in <module> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor

what does that mean? and how can I fix this? I have tried to look for answer in the internet, but none works. Im new to python programming, so please be nice to me :)

what does this error message means?

hello. Im trying to make a face detection from live video feed using haar cascade by using this code

import cv2 import sys

faceCascade = cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml')

video_capture = cv2.VideoCapture(0)

while True: ret, frame = video_capture.read() video_capture.read()

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  faces = faceCascade.detectMultiScale(
     gray,
     scaleFactor=1.1,
     minNeighbors=5,
     minSize=(30, 30),
     flags=cv2.CASCADE_SCALE_IMAGE
    )

)

for (x, y, w, h) in faces:
    cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)


cv2.imshow('Video', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

video_capture.release() cv2.destroyAllWindows()

but then I got this error message

Traceback (most recent call last): File "/home/pi/pythonpy/videofacedet.py", line 17, in <module> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor

what does that mean? and how can I fix this? I have tried to look for answer in the internet, but none works. Im new to python programming, so please be nice to me :)

click to hide/show revision 3
No.3 Revision

updated 2017-06-23 04:14:42 -0500

berak gravatar image

what does this error message means?

hello. Im trying to make a face detection from live video feed using haar cascade by using this code

import cv2
import sys

sys faceCascade = cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml')

cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml') video_capture = cv2.VideoCapture(0)

cv2.VideoCapture(0) while True: ret, frame = video_capture.read()

video_capture.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  faces = faceCascade.detectMultiScale(
     gray,
     scaleFactor=1.1,
     minNeighbors=5,
     minSize=(30, 30),
     flags=cv2.CASCADE_SCALE_IMAGE
 )

 for (x, y, w, h) in faces:
     cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)


 cv2.imshow('Video', frame)

 if cv2.waitKey(1) & 0xFF == ord('q'):
     break

video_capture.release()
cv2.destroyAllWindows()

video_capture.release() cv2.destroyAllWindows()

but then I got this error message

Traceback (most recent call last): last):

  File "/home/pi/pythonpy/videofacedet.py", line 17, in <module>
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor

cvtColor

what does that mean? and how can I fix this? I have tried to look for answer in the internet, but none works. Im new to python programming, so please be nice to me :)

what does this error message means?

hello. Im trying to make a face detection from live video feed using haar cascade by using this code

code:

import cv2 import sys sys

faceCascade = cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml') cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml')

video_capture = cv2.VideoCapture(0) cv2.VideoCapture(0)

while True: ret, frame = video_capture.read() video_capture.read()

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  faces = faceCascade.detectMultiScale(
     gray,
     scaleFactor=1.1,
     minNeighbors=5,
     minSize=(30, 30),
     flags=cv2.CASCADE_SCALE_IMAGE
 )

 for (x, y, w, h) in faces:
     cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)


 cv2.imshow('Video', frame)

 if cv2.waitKey(1) & 0xFF == ord('q'):
     break

video_capture.release()
cv2.destroyAllWindows()

video_capture.release() cv2.destroyAllWindows()

but then I got this error message

Traceback (most recent call last):

last):
  File "/home/pi/pythonpy/videofacedet.py", line 17, in <module>
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor
cvtColor

what does that mean? and how can I fix this? I have tried to look for answer in the internet, but none works. Im new to python programming, so please be nice to me :)

click to hide/show revision 5
retagged

updated 2017-06-24 01:16:22 -0500

berak gravatar image

what does this error message means?

hello. Im trying to make a face detection from live video feed using haar cascade by using this code:

import cv2 import sys

faceCascade = cv2.CascadeClassifier('/home/pi/opencv-3.1.0/data/haarcascades/haarcascade_frontalface_default.xml')

video_capture = cv2.VideoCapture(0)

while True: ret, frame = video_capture.read()

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(
    gray,
    scaleFactor=1.1,
    minNeighbors=5,
    minSize=(30, 30),
    flags=cv2.CASCADE_SCALE_IMAGE
)

for (x, y, w, h) in faces:
    cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)


cv2.imshow('Video', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

video_capture.release() cv2.destroyAllWindows()

but then I got this error message

Traceback (most recent call last): File "/home/pi/pythonpy/videofacedet.py", line 17, in <module> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) error: /home/pi/opencv-3.1.0/modules/imgproc/src/color.cpp:8000: error: (-215) scn == 3 || scn == 4 in function cvtColor

what does that mean? and how can I fix this? I have tried to look for answer in the internet, but none works. Im new to python programming, so please be nice to me :)