Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

there is no such thing as cv2.VideoCapture.open() (without any arguments)

that's just bad code, a bug, if you want. problem is here

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        self._camera.open()

see, problem is, what to do, if the camera could not be opened with the specified id ? the author did not have a case for that, it probably did never happen to him, but again, bad code ...

proposal: raise an exception, and stop it:

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        raise Exception("could not open camera" + str(device_id))

there is no such thing as cv2.VideoCapture.open() (without any arguments)

that's just bad code, a bug, if you want. problem is here

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        self._camera.open()

see, problem is, what to do, if the camera could not be opened with the specified id ? the author did not have a case for that, it probably did never happen to him, but again, bad code ...

proposal: raise an exception, and stop it:

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        raise Exception("could not open camera" camera " + str(device_id))

there is no such thing as cv2.VideoCapture.open() (without any arguments)

that's just bad code, a bug, if you want. problem is here

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        self._camera.open()

see, problem is, what to do, if the camera could not be opened with the specified id ? the author did not have a case for that, it probably did never happen to him, but again, bad code ...

proposal: raise an exception, and stop it:

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        raise Exception("could not open camera " + str(device_id))

(then, btw, opencv's face-recognition is made for identification (closest from a database), while the task there seems to be authentification (is that me?) -- it's the wrong tool for the job)

(be suspicious of anything in that coodebase !)

there is no such thing as cv2.VideoCapture.open() (without any arguments)

that's just bad code, a bug, if you want. problem is here

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        self._camera.open()

see, problem is, what to do, if the camera could not be opened with the specified id ? the author did not have a case for that, it probably did never happen to him, but again, bad code ...

proposal: raise an exception, and stop it:

    self._camera = cv2.VideoCapture(device_id)
    if not self._camera.isOpened():
        raise Exception("could not open camera " + str(device_id))

(then, btw, opencv's face-recognition is made for identification (closest from a database), while the task there seems to be authentification (is that me?) -- it's the wrong tool for the job)

(be suspicious of anything in that coodebase codebase !)