opencv / opencv/opencv-python

TypeError: VideoCapture() takes no arguments

Open
#518 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

incomplete
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

This is the code which iam tryng in PyCharm

import cv2
import time

cap = cv2.VideoCapture(0)


while True:
    success, img = cap.read()
    cv2.imshow("Image", img)
    cv2.waitKey(1)

Iam getting below error

"C:\Users\Support ACTA\AppData\Local\Programs\Python\Python37\python.exe" "E:/Project/Python/advanced computer vision/Face Detection/FaceDetectionMin.py"
Traceback (most recent call last):
  File "E:/Project/Python/advanced computer vision/Face Detection/FaceDetectionMin.py", line 4, in <module>
    cap = cv2.VideoCapture(0)
TypeError: VideoCapture() takes no arguments

If I use the the video path also, same error iam getting

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The failure is reported in FaceDetectionMin.py at cv2.VideoCapture(0), with the same result for a video path. Start by reproducing that entry point and inspecting the installed cv2 package and VideoCapture binding; done means identifying the root cause and verifying a fix for both camera and file input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.