Cannot connect into web camera using opencv - python

I have a program that is a face recognition application and I want to run it on a PC client.
But it shows an error like this
I think it might be that the program cannot connect to any camera device in my client ,
in my python code i use this
cap=cv2.VideoCapture(0)
and i have install logitech camera driver in my client pc
but it is still can not detect any camera in my client
how can i solve this?

I've had this issue before and what solved it for me was using a different USB port on the PC for the webcam. It was due to the driver being connected to certain ports that opencv read from.

Related

Remote GPIO (Pigpio) with input from laptop and output from Raspberry Pi

I'm working on an object detection project for IoT using a webcam and servo. In short, when the object detected by the webcam matches the data in the system, the servo will move. Can the webcam be connected to the laptop, and the servo on the Raspberry Pi? So the input is from the laptop and the output is on the Raspberry Pi using pi-gpio (Remote GPIO). How to? Thanks.
This link shows the GPIO Zero library being used with pigpio to allow remote control of the GPIO pins, from either another raspberry pi - or a PC. Once you configure GPIO Zero to use the pigpio library and connect, I believe you can just use the GPIO Zero libraries as per normal to control the Servo. (though I have not tried this myself!)
However I would probably use MQTT to decouple the two systems. If you run an MQTT broker on the Raspberry Pi (eg. Mosquitto) then the webcam software can publish a message to the MQTT broker, and the raspberry pi software can subscribe and act accordingly.
You can also run this with a cloud based MQTT system (eg. HiveMQ) so the Raspberry Pi and the PC with the Webcam don't even have to be in the same location.
A quick way is to use the Python socket library. Both devices need to be connected to the same network, and the sender needs to know the IP address of the receiver.

Bleak can't find Arduino Nano 33 BLE

I want to read gyroscope and acceleration values from an Arduino Nano 33 BLE board by using Bleak on a Windows OS. The code to make the discovery is the default Bleak code (see here). On Arduino I use a code similar to this one, except that I work with the gyroscope and the accelerometer.
Using the Android nRF Connect application I can view the device and the characteristic. Using Bleak instead I can't see any device.
Is it possible to have a problem with permissions on Windows?
I tried to connect it via Bluetooth to the pc first, but Windows 10 says: try to connect your device again. But the Arduino sketch sees the connection attempt as a Central BLE device connecting, in fact he enters the while loop and starts sending data.
How to solve it?

How to fix "VIDEOIO ERROR: V4L: can't find camera device" when opening a camera with Python OpenCV?

I am trying to use Python OpenCV on a Windows Ubuntu terminal for a research project. However, when I try to open my camera to capture video I get VIDEOIO ERROR: V4L: can't find camera device. How can I access my camera using OpenCV?
I tried to use v4l2-ctl --list-devices and I get Failed to open /dev/video0: No such file or directory. The camera on my computer works when using the camera application.
I am using the following cv2 command to grab the video capture device.
import cv2
stream = cv2.VideoCapture(-1)
Ubuntu for Windows is based on Windows Subsystem for Linux (WSL). WSL does not provide hardware support so it can't provide you with a driver for your camera. See this question as well.

How to establish serial connection with Bluetooth device on Win7

I am really frustrated and have no idea where to search for an answer.
Currently I am working on a project to detect drowsiness with an ECG device (Zephyr Bioharness 3). The device works but I can't find it with windows (For example like this). I tried several things:
Find the device with my Smartphone -> works
Find the device with an Ubuntu on the same Laptop -> works
Connect directly on Win7 via Bluetooth with this Python Script: Gist -> connects and sends data
Find other Bluetooth devices with my Laptop on Win7 -> Bluetooth radio is dound
COM port for (virtual) serial connection to a bluetooth device (device manager)
What I am trying, is getting this script to work: ZephyrApp. Beside some compatibility problems with QT and serial (which I was able to fix), the programm hangs here protocol.py. I suspect the problems of not finding the device relates to the problems with the program. I know this is very special case, but hope anyone has an idea, how to fix this.
Regards,
paul
EDIT: Another PC with Win7 can't detect the device as well, it seems it is a Windows problem.
The device can't be detected with Win7, but I found a way to connect via bluetooth directly: https://gist.github.com/darkopetrovic/2127217

OpenCV VideoCapture cant open/read url

My current OpenCV version is 2.4.13. Python version is 2.7.11. My operating system is OS X Yosemite 10.10.5. I've been trying to use VideoCapture() to read url but keep getting this:
WARNING: Couldn't read movie file
VideoCapture() works fine with my laptop's webcam and local files. For example, I can open and play video like this:
cv2.VideoCapture("sg04video.mov")
But I am trying to access my ip camera with OpenCV. At first I thought I had the wrong url or it was some authentication problem. I disabled authentication, tried several camera urls(both rtsp and http) and could open them in VLC player. VLC player can also open other resources like this one: random rtsp video link
I even managed to open the url for capturing camera view image in my browser.
But cv2.VideoCapture cant open any of those urls, both video and image, whether its for my own camera or from the internet. Im sure the problem is not with the ip camera.
I am relatively new to programming and I installed OpenCV following this guide:
Installing OpenCV 2.4.9 on Mac OSX with Python Support
Please help!! Thanks!

Categories