shantnu / FaceDetect

825 stars 1.25k forks source link

list index out of range #22

Closed ShehabMuhammad closed 3 years ago

ShehabMuhammad commented 5 years ago

in my python 3.7 on window 8 , and I have installed opencv-python through pip

I import cv2 and sys and everything.. But.. When it reaches imagePath = sys.argv[1] or cascPath = sys.argv[2] It says:

list index out of range. !

I changed it to 0, and it passes, but then it tells me assertion error

for that line: gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

what's the solution?

arnav095 commented 5 years ago

I am facing the same issue and I also need help regarding this.

arnav095 commented 5 years ago

in my python 3.7 on window 8 , and I have installed opencv-python through pip

I import cv2 and sys and everything.. But.. When it reaches imagePath = sys.argv[1] or cascPath = sys.argv[2] It says:

list index out of range. !

I changed it to 0, and it passes, but then it tells me assertion error

for that line: gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

what's the solution? have you found the solution?

Elect96 commented 5 years ago

Hey! I have faced the very same problem. You need to open up your python file with the Terminal using: "python your_project_name.py your_picture.jpg".

If you are using PyCharm you can find the Terminal on the bottom, it lives between "TODO" and "Python Console" tabs.

Hope it helps. ~Elect96

hemali-14 commented 5 years ago

I'm facing same issue. I import sys

image_path = sys.argv[1] IndexError: list index out of range

I tried with sys.argv[0] it is working fine