I'm working with python and using wx for my GUI. I'm using OpenCv to capture frames from my webcam and this works fine when using the webcams default driver. However, I'm also trying to use pyUSB with a libusb backend to detect which USB devices are plugged in at any given moment. In order to use pyUSB to determine which devices are plugged in, I need to use libusb to generate a driver for the webcam. The driver generated from libusb is automatically installed and then I can use pyUSB's find usb.core.find method to enumerate the USB devices connected.
My problem is that now OpenCv is unable to capture frames. I believe my code actually gets a camera capture object and it gets the frames, but the frames are black. I can immediately check that the driver is causing the problem by uninstalling the libusb driver and reinstalling the default webcam driver. Do I need to instruct OpenCv to use this new libusb driver? If so, how? Google didn't turn up anything obvious.
Edit: In case it's important, I'm on Windows 7 64 bit using python 2.7.3
Related
I am trying to setup My Ubuntu Desktop wallpaper that accepts a Live video feed from webcam using opencv and after performing some object detection I accept it as Opencv feed where I am able to Display it using cv2.imshow.
But instead of Using Imshow is it possible to cast the output of object detection as ubuntu desktop live Wallpaper.
I am even able to setup live video from youtube as Ubuntu live wallpaper using cvlc but unable to understand how to do that from opencv output.
You might have to go with a lot of trouble as looks like its never been implemented but you can try implementing by one of the following ways :
Try saving the frames and consciously deleting the old frame at a
same time changing background from os call.
if you are able to make cvlc run You can try running it by cv::VideoWriter or Streaming
video to localhost and then using similar YouTube approach you
were doing.
You can Try using Streamlink/MPV/Xwinwrap fork.
You can save the desired results using cv2.imwrite() and then try the methods described here and here
I have created an app that displays rtsp streams in Kivy grid view. It works just fine on my computer, but when I deploy it to another PC everything works up until the video needs to be playing in the grid (i just get white squares in the lower left of the tile). I strongly feel that there is a package I need to download that Kivy Documentation does not mention.
I have pip installed all kivy dependencies, Cython, and Pillow on the other PC.
I would like to see video in each block as I do on the PC that I built the app on
No RTSP Stream Coming Through
***Update: (On the other PC (mini PC)) I uninstalled Python 3.7.3, reinstalled it, installed kivy in the proper order according to their install for windows documentation, and installed Cython. This got it working but now some the text is missing in the app. Also, I am getting multiple .dll errors (libopus-0.dll and libgstopus.dll) I tried removing gstreamer from the python share folder and that got it back to just showing white boxes.
I am working with python opencv and I am not able to disable autofocus, autoexposure etc on windows 10.
I am using Logitech BRIO 4k webcam.
Everything works perfectly on Ubuntu 18.04. With Opencv 3.4.4 using v4l backend I am able to set focus, exposure, video resolution successfully. However the same code doesn't work on windows
on windows I have tried:
Unofficial pre-built OpenCV packages for Python: opencv-contrib-python https://pypi.org/project/opencv-contrib-python/
build from source opencv 3.4.3 with MSMF, VFW, DSHOW backends.
With VFW I am not able to open video capture at all
build from source opencv 4.1 with MSMF, DSHOW backends
in every case above (except VFW backend) I am able to use opencv functionality, read and show frames from a webcam, but not able to disable autofocus.
code that I use from official opencv GitHub repo https://github.com/opencv/opencv/blob/master/samples/python/video_v4l2.py
I create video capture like so to specify backend VideoCapture(0 + BACKEND_ID) where BACKEND_ID is taken from here
https://docs.opencv.org/3.4.3/d4/d15/group__videoio__flags__base.html
Environmental variable OPENCV_VIDEOIO_DEBUG=True
confirms that I use particular backend
Questions on the same topic without answers Disable webcam's autofocus in Windows using opencv-python
cap.set( cv.CAP_PROP_SETTINGS, 1 );
doesn't work on both windows and linux
Since the code works on linux I believe that the problem is in the videoio backend. Can you suggest some other backend or maybe v4l analog on windows that opencv supports.
Forgot to mention, I was using virtual box to run on windows.
If I run the same code on windows machine directly everything works))
Must be some problem with virtual box
The only difference is that focus values seem to be in range 0-255. But in the sample code I provided above they are in 0-100 range
I'm trying to access a live video feed from my Raspberry Pi with a PiCam attached. I have enabled the camera in the interface settings and even tested it by snapping some pictures and videos using the PiCam library. However, OpenCV is giving me troubles. I installed open CV following this tutorial (shoutout to Adrian Rosenbrock).
Check out the screenshot below for the code and the error message. I'm running everything from within a virtual environment with OpenCV installed, like Adrian suggests.
Code and error message
VIDEOIO ERROR: V4L: can't open camera by index 0
From what I've read from other problems people have had, this error is sometimes resolved by playing with the index value. If i change the index value to -1 or 1, like most solutions suggest, i either get the same thing or a slightly different "can't access camera" error.
I'm relatively new to OpenCV and RPi so I might just be missing something simple. Any suggestion is much appreciated, thanks!
You may need to enable access to the camera. Try typing:
sudo modprobe bcm2835-v4l2 in terminal on your RPI.
I tried to interface a Thorlabs camera DCU223M with opencv 2.4.5 and python 2.7 (under windows 7). I notice that people managed to interface a DC1545M. See: Setting Camera Parameters in OpenCV/Python
I used the same procedure but it does not work. An error occurs while cv2.imshow is invoked.
ret=0 and img is none... that is the main reason. What can I do to interface this camera?
Thank you in advance,
stéphane