Zbar Python Library : Control camera resolution - python

I am using zbar python library on Raspberry Pi3 for scanning QR code.
I have USB camera mounted on /dev/video0.
I want to control camera resolution.
(Reduce resolution to improve performance)
I am not able to find any interface for same.
I have tried using request_size but getting below error:
zbar.Processor() object has no attribute 'request_size'
Edit:
I am using process_one method.
Edit2:
Below is my code:

Related

Use OneWire in Python on Raspberry OS

I want to use Python to access OneWire devices directly on my Pi 4b without using the device-file method (open a device file, read its contents, close the file ... for each device on the bus). Installing the right library/package/whatever on my Pi seems to be a bit more Linux than I have experience for. Is there a simple set of instructions somewhere for this?

Ubuntu Open CV Video Capture

I got a problem with open cv real-time video capturing from camera. I have tried many solutions/suggestions which are available out there but not working for me. Following are the problems:
cap = cv2.VideoCapture(0)
when I tried to get video with this following error comes up:
[ WARN:0] VIDEOIO ERROR: V4L: can't open camera by index 0
Could not open video device
<VideoCapture 0x7fd99e6b5330>
Even though it is reading the video reference.
And from one solution by https://github.com/skvark/opencv-python/issues/124 I tried with
cap = cv2.VideoCapture(-1)
But this does not worked for me as it gives the error:
Video device not found
By trying sudo modprobe bcm2835-v4l2 command I got modprobe: FATAL: Module bcm2835-v4l2 not found in directory /lib/modules/4.15.0-66-generic this error. I'm not finding a way to get out of it.
It is working fine on my MacBook locally but when I tried to deploy on Ubuntu server I'm facing these errors in loop. Can anyone help me on it? Thanks in advance.
Can you open your webcam through other apps?
If not firslty try to reinstall webcam driver.
if you can do it, either some app is using webcam so cv2 can't get access to it or you did not install 3rdparty libraries to work with cameras/videos. You need to install them properly before building OpenCV Python bindings.
( you can find some info there: https://github.com/opencv/opencv/issues/8471 )
Following is the response from hosting server:
"The directory video0 would not exist because our droplets do not have any peripherals attached to them. The function cv2.VideoCapture() attempts to obtain the video capture from a webcam which a droplet would not have.
If you are wanting to stream a remote feed you should be able to do this via RTSP:
https://stackoverflow.com/questions/29099839/opencv-stream-from-a-camera-connected-to-a-remote-machine"
The problem is with droplet which don't have that functionality which we are trying to achieve.
Thanks to all for your love, support and help. Really appreciated. It might help someone else as well.

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.

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!

Running a kinect on Raspberry Pi - Python

I am trying to run Vision Processing python code, through Raspberry Pi with the Microsoft Kinect camera.
I have perfectly working code running on Ubuntu but it fails to perform the same on the RPi.
I think I have all libraries installed on it...
I even tryied the following simple code:
import freenect
ir, data = freenect.sync_get_video(format=freenect.VIDEO_IR_8BIT)
print ir
It doesn't work, it gets stuck.
What could the reason?
Maybe the kinect and the raspberry Pi dont work together?
Note: When I try "freenect-glview" I get: "Number of devices found: 1"
Did you try using OpenNI SDK. I tried and it works with OpenNI Also do you have a powered USB hub as PI can't generate enough energy to power Kinect.
Kinect does not work on RPI due to an usb driver bug :
Linux Driver Issues
Shortly after the Raspberry Pi was released it was confirmed that there were a number of issues with the Linux USB driver for the
SMSC95xx chip.
These included problems with USB 1.x peripherals that use split transactions, a fixed number of channels (causing problems with
Kinect) and the way the ARM processor handles the SMSC95xx interrupts.
[2] [3] A large number of fixes were included in the
2012-08-19-Wheezy-raspbian Linux image.
source http://elinux.org/RPi_VerifiedPeripherals

Categories