0

Here is the code:

import cv2
import sys

cascPath = sys.argv[1]
faceCascade = cv2.CascadeClassifier(cascPath)

video_capture = cv2.VideoCapture(0)

while True:
    # Capture frame-by-frame
    ret, frame = video_capture.read()

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

and this is where the error pops up:

cascPath = sys.argv[1]

I don't know if the error is because I have not started a list although when I did start a list nothing happened and the error was still there

(this is not all the code as stack overflow did not allow me although I think this should be enough)

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • 4
    Does this answer your question? ["list index out of range" when using sys.argv\[1\]](https://stackoverflow.com/questions/15121717/list-index-out-of-range-when-using-sys-argv1) – Kieran Moynihan Jul 02 '21 at 20:20
  • Read the documentation for `sys.argv` https://docs.python.org/3/library/sys.html?highlight=sys.argv#sys.argv -always a good idea to read the documentation. – DisappointedByUnaccountableMod Jul 02 '21 at 22:06

0 Answers0