Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

new to opencv python and clarification on certain things

I am a total newbie in opencv+python

I will like to clarify some things in regards to my project

  1. what is a suitable GUI that I can work with using opencv+python? is TkInter sufficient for compiling the codes that I have from opencv+python?

  2. I have been encountering these errors from various documented opencv codes based on these websites https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html#face-detection

for this website i seem to be facing this error when i try to compile it on TkInter Traceback (most recent call last): File "C:\Users\Jian Quan\Desktop\simulation\cameratest.py", line 8, in <module> gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) error: ......\src\opencv\modules\imgproc\src\color.cpp:3402: error: (-215) scn == 3 || scn == 4

while for another example that i tried, this is the error I encountered

#!/usr/bin/python import cv2 img = cv2.imread("Lenna.png") hc = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml") faces = hc.detectMultiScale(img) for face in faces: cv2.rectangle(img, (face[0], face[1]), (face[0] + face[2], face[0] + face[3]), (255, 0, 0), 3) cv2.imshow("Lenna's face", img) if cv2.waitKey(5000) == 27: cv2.destroyWindow("Lenna's face") cv2.imwrite("LennaFace.png", img)

this is the error:

Traceback (most recent call last): File "C:\Users\Jian Quan\Desktop\simulation\test.py", line 11, in <module> cv2.imshow("Lenna's face", img) error: ......\src\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0

can anyone out there help me clarify the issues that I m facing at the moment? thanks so much

click to hide/show revision 2
retagged

updated 2013-11-03 03:49:38 -0600

berak gravatar image

new to opencv python and clarification on certain things

I am a total newbie in opencv+python

I will like to clarify some things in regards to my project

  1. what is a suitable GUI that I can work with using opencv+python? is TkInter sufficient for compiling the codes that I have from opencv+python?

  2. I have been encountering these errors from various documented opencv codes based on these websites https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html#face-detection

for this website i seem to be facing this error when i try to compile it on TkInter Traceback (most recent call last): File "C:\Users\Jian Quan\Desktop\simulation\cameratest.py", line 8, in <module> gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) error: ......\src\opencv\modules\imgproc\src\color.cpp:3402: error: (-215) scn == 3 || scn == 4

while for another example that i tried, this is the error I encountered

#!/usr/bin/python import cv2 img = cv2.imread("Lenna.png") hc = cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml") faces = hc.detectMultiScale(img) for face in faces: cv2.rectangle(img, (face[0], face[1]), (face[0] + face[2], face[0] + face[3]), (255, 0, 0), 3) cv2.imshow("Lenna's face", img) if cv2.waitKey(5000) == 27: cv2.destroyWindow("Lenna's face") cv2.imwrite("LennaFace.png", img)

this is the error:

Traceback (most recent call last): File "C:\Users\Jian Quan\Desktop\simulation\test.py", line 11, in <module> cv2.imshow("Lenna's face", img) error: ......\src\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0

can anyone out there help me clarify the issues that I m facing at the moment? thanks so much