Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

when I run the below code, I take below error. Can you help me ?

import cv2 import numpy as np

image = cv2.imread('yüz1.jpg')

faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(image,1.1,4)

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

cv2.imshow('faces', image) cv2.waitKey(0) cv2.destroyAllWindows()

"C:\Users\asus\Documents\Python Çalışma\venv\Scripts\python.exe" "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py" Traceback (most recent call last): File "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py", line 8, in <module> greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

click to hide/show revision 2
None

updated 2018-10-15 08:10:32 -0600

berak gravatar image

when I run the below code, I take below error. Can you help me ?

import cv2 import numpy as np

image = cv2.imread('yüz1.jpg')

cv2.imread('yüz1.jpg')

faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(image,1.1,4)

faceCascade.detectMultiScale(image,1.1,4)

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

(x+w,y+h),(0,255,0),3)

cv2.imshow('faces', image) cv2.waitKey(0) cv2.destroyAllWindows()

cv2.destroyAllWindows()

"C:\Users\asus\Documents\Python Çalışma\venv\Scripts\python.exe" "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py" Traceback (most recent call last): File "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py", line 8, in <module> greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

'cv::cvtColor'

when I run the below code, I take below error. Can you help me ?

import cv2 import numpy as np

image = cv2.imread('yüz1.jpg')

faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(image,1.1,4)

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

cv2.imshow('faces', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

"C:\Users\asus\Documents\Python Çalışma\venv\Scripts\python.exe" "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py"
Traceback (most recent call last):
  File "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py", line 8, in <module>
    greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

The Result :

Check image path

But image and code is the same path then it is writing continuous 'Check image path' when I run the code

click to hide/show revision 4
No.4 Revision

updated 2018-10-17 11:14:29 -0600

berak gravatar image

when I run the below code, I take below error. Can you help me ?

import cv2
 import numpy as np

np
image = cv2.imread('yüz1.jpg')
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(image,1.1,4)
for(x,y,w,h) in faces :
cv2.rectangle(image, (x,y), (x+w,y+h),(0,255,0),3)
cv2.imshow('faces', image)
cv2.waitKey(0)
cv2.destroyAllWindows()

"C:\Users\asus\Documents\Python Çalışma\venv\Scripts\python.exe" "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py"
Traceback (most recent call last):
File "C:/Users/asus/Documents/Python Çalışma/İmageProcessing/faceDetection.py", line 8, in <module>
greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

The Result :

Check image path

But image and code is the same path then it is writing continuous 'Check image path' when I run the code