Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing VideoCapture / Webcam doesn't work #4739

Open
opencv-pushbot opened this issue Jul 27, 2015 · 3 comments
Open

Releasing VideoCapture / Webcam doesn't work #4739

opencv-pushbot opened this issue Jul 27, 2015 · 3 comments

Comments

@opencv-pushbot
Copy link
Contributor

Transferred from http://code.opencv.org/issues/3672

|| Martijn van der Veen on 2014-05-02 21:02
|| Priority: Normal
|| Affected: branch 'master' (3.0-dev)
|| Category: python bindings
|| Tracker: Bug
|| Difficulty: Medium
|| PR: 
|| Platform: x64 / Linux

Releasing VideoCapture / Webcam doesn't work

Using python (3.4) bindings on Ubuntu 14.04 with build-in webcam using v4l4, master branch:

In [2]: cap = cv2.VideoCapture(0)
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP

In [3]: a,b = cap.read() # although error, reading frame works (a=True, b=np.array)

In [4]: cap.release()

In [5]: cap.isOpened()
Out[5]: False

In [6]: cap = cv2.VideoCapture(0)
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

In [7]: a,b = cap.read()
VIDIOC_STREAMON: Bad file descriptor


After calling .release(), webcam light stays on and webcam stays unreachable for other programs (e.g., Cheese).

History

Martijn van der Veen on 2014-05-02 21:24
(Btw, the webcam _is_ released when python exits, but in some cases that's not enough - e.g., for running programs that need to release the webcam now and then.)
Alexander Smorkalov on 2014-05-04 15:58
-   Category set to python bindings
Andrew Senin on 2014-05-06 14:21
Hello Martijn, 

Since our resources are limited please consider investigating this issue and creating a fixing pull request (http://code.opencv.org/projects/opencv/wiki/How_to_contribute). All help to the project is highly appreciated!
-   Difficulty set to Medium
-   Assignee set to Martijn van der Veen
-   Status changed from New to Open
Maksim Shabunin on 2015-04-27 09:12
-   Target version changed from 3.0-beta to 3.0
Maksim Shabunin on 2015-04-28 13:42
Can not reproduce with the 3.0-rc1 release. Webcam is successfully released and reopened.

Can you, please, try to reproduce it with the latest version? Probably it has been fixed already.
-   Assignee changed from Martijn van der Veen to Maksim Shabunin
Maksim Shabunin on 2015-04-28 13:42
-   Status changed from Open to Incomplete
@brianmichalk1
Copy link

I assume nobody has picked this up? This bug is affecting me as well for OpenCV for Java. I am on a tight deadline but can work around this bug. After I complete my tasks here, I could look into this. If its possible, I could pick this up in three months.

@Dikay900
Copy link
Contributor

@brianmichalk1 feel free to pick this up if you can provide a fix via a Pullrequest

@timele
Copy link

timele commented May 17, 2017

Have come over this bug, in c++, affects using OpenBR, which is dependent upon OpenCV 2.4*.
If this bug is resolved in OpenCV 3.* will this issue be resolved in OpenCV 2.4.*?
OpenBR: v 1.1.0
Leptonica: v 1.74.1
OpenCV: v. 2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants