Ask Your Question

xiaoerlaigeid's profile - activity

2016-11-03 05:08:30 -0600 commented question error python

Thanks, I have find the problem.

2016-11-01 09:00:08 -0600 asked a question error python
import numpy as np
import cv2
from matplotlib import pyplot as plt

face_cascade = cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_eye.xml')

cap=cv2.VideoCapture(0)

while 1:
    ret, img=cap.read()
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces=face_cascade.detectMultiScale(gray,1.3,5)
    for(x,y,w,h) in faces:
        img = cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
        roi_gray= gray[y:y+h, x:x+w]
        roi_color = img[y:y+h, x:x+w]

        eyes = eye_cascade.detectMultiScale(roi_gray)
        for (ex,ey,ew,eh) in eyes:
            cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
    cv2.imshow('img',img)
    k=cv2.waitKey(30)  & 0xff
    if k==27:
        break
    cap.release()
    cv2.destroyAllWindows()

I'm trying to use facedectecting.but I don't know why i cant open my camera. other code can open my camera. this is error information

 File "face.py", line 12, in <module>
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:7456: error: (-215) scn == 3 || scn == 4 in function cv::ipp_cvtColor

 -

2016-10-30 02:13:45 -0600 commented answer How to create multiple VideoCapture Obejcts

btw ,what's mean "glob.glob(r'C:\Users\chaitanya\Desktop\Thesis*.avi')"

2016-10-30 02:08:02 -0600 answered a question Videocapture in opencv 3.0.0 is not reading the video

i think virtual machine can't get the permission to open your camera. I have the same problem.

2016-10-30 02:05:55 -0600 answered a question error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')

these two is wrong. you should add the path .

 face_cascade =   
 cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_frontalface_default.xml')
 eye_cascade = cv2.CascadeClassifier(r'D:\OpenCV\opencv\sources\data\haarcascades\haarcascade_eye.xml')
2016-10-30 01:39:50 -0600 received badge  Supporter (source)
2016-10-30 01:35:55 -0600 commented answer OpenCV - Python Instalation

OK,all right. cmake is complicated in windows.If your goal just install opencv, there many other choice.

2016-10-30 01:20:09 -0600 commented answer OpenCV - Python Instalation

https://pypi.python.org/pypi?%3Aactio... enter the website find your suitable edition opencv package, and ues pip to install it .

2016-10-30 01:13:50 -0600 answered a question OpenCV - Python Instalation

suggest you can download opencv-pyhton edition use cmd pip install (the opencv-python edition)