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

added cv.CAP_DSHOW to cv.Videocapture to fix https://github.com/vlachoudis/bCNC/issues/1526 #1530

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ldpgh
Copy link

@ldpgh ldpgh commented Feb 7, 2021

added cv.CAP_DSHOW to cv.Videocapture
fix issue: #1526
by answer: https://answers.opencv.org/question/234933

added  cv.CAP_DSHOW to fix issue on Win7 (crash)
answer: https://answers.opencv.org/question/234933
issue: vlachoudis#1526
fix typo in the comment
@ldpgh
Copy link
Author

ldpgh commented Feb 7, 2021

App-Test
(1) cv2+Py3.7.4 ... ok

>>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv
>>> cv.__version__
'4.4.0'
>>> cam=cv.VideoCapture(0, cv.CAP_DSHOW)
>>> img=cam.read()
>>> print(img[1][0])
[[ 0 14 11]
 [ 0 15 12]
 [ 0 12 10]
 ...
 [ 5  7  1]
 [ 4  6  5]
 [ 4  6  5]]
>>> quit()
>>

(2) Py3.7.4+bCNC ... ok

(3) cv2+Py2.7.12 ... ok

>>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv
>>> cv.__version__
'4.2.0'
>>> cam=cv.VideoCapture(0, cv.CAP_DSHOW)
>>> img=cam.read()
>>> print(img[1][0])
[[ 8 10 10]
 [ 8 10 10]
 [ 4 11  9]
 ...,
 [ 6  8  9]
 [ 6  8  8]
 [ 4  6  6]]
>>> quit()
>>

(4) Py2.7.12+bCNC ... ok ... just checked CameronOn/VideoStream/CameraOff

@Harvie
Copy link
Collaborator

Harvie commented Feb 16, 2021

This does not seem very portable to me. You must understand that bCNC has lots of users running Linux, MacOS and perhaps even other operating systems.

By default the OpenCV selects the best available video backend. If OpenCV does not select the correct backend i beleive this is a bug in OpenCV and you should consult developers of OpenCV project. Hardcoding windows-based backend is simply not going to happen in bCNC.

@Harvie
Copy link
Collaborator

Harvie commented Feb 16, 2021

Oh and now i've read the #1526
It says the camera works but crashes after few moments. If there is crash caused by OpenCV, they should fix it.

@Harvie
Copy link
Collaborator

Harvie commented Sep 25, 2023

The proposed fix feels like it might mess up bCNC on Linux and OSX (not sure tho)
Is this still an issue with latest opencv? Maybe we can just increase the opencv version in setup.py

@Harvie
Copy link
Collaborator

Harvie commented Feb 9, 2024

cv.CAP_DSHOW reportedly breaks opencv at MacOS.

https://www.reddit.com/r/learnpython/comments/oxo3gd/why_do_i_have_to_use_cv2cap_dshow/

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

Successfully merging this pull request may close these issues.

2 participants