Thorlabs camera DCU223M with opencv and python - python

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

Related

Unable to change exposure settings for CSI Pi Camera on Raspberry Pi 64 bit Bullseye

Tried varying the expsoure settings for the Pi CSI based camera using libcamera library in python.
Tried out multiple methods which did not lead to successful implementation.
Unable to vary exposure using the following example code:
cam.set(libcamera.AeEnable, 0)
cam.set(libcamera.ExposureValue, 4)
cam.set(libcamera.ExposureTime, 100000)
cam.set(libcamera.AnalogueGain, -0.1)
Experienced no change in exposure when varying the above settings over libcamera.
But I was successful in varying the brightness using the following command:
cam.set(libcamera.Brightness, -1)
I also tried using the PiCamera library and experienced the following error:
OSError: libmmal.so: cannot open shared object file: No such file or directory
Found that the community has already faced similar problems.
The posts shared that the above library is not present in 64 bit os.
I also tried sudo modprobe bcm2835-v4l2 inorder to have the CSI camera detected as a device allowing it to be accessed using OpenCV since several blog posts shared this procedure as a possibility.
The camera was not picked up over OpenCV and returned nothing.
Blog
Hackster Blog

Is it possible to disable autofocus of a webcam on Windows 10?

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

Error displaying video stream using Opencv on raspberry pi

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.

Opencv webcam with libusb driver python

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

Webcam: libv4l2 & VIDIOC_DQBUF : No such device

I have written a python code by using OpenCV library to detect a motion. If a motion occurs, it takes a snapshot of the moving object. However my problem is this: If I execute the program on my PC (Ubuntu 12.04) everything's OK.
But when I execute the program on my BeagleBone which has Angstrom Linux running and an Us Robotics webcam device attached to it, after a while it gives the following error:
libv4l2: error dequeuing buf: No such device
VIDIOC_DQBUF: No such device
How can I solve this problem?
Regards
edit: I installed ubuntu 12.04 to my BeagleBone and everything is OK with it too. It seems like my problem is related to Angstrom image. Maybe a driver or a library (libv4l2?) problem? Any ideas?
I was seeing this error with Ubuntu also when the board was powered through the USB cable. When I powered the board with a 5V supply, the problem went away.
I experienced the same problem. I even changed my board because of this error. But when I resorted back to my older power supply, it was gone. As simple as that.

Categories

Resources