Accessing a webcam with Python 3.X - python

For a school project I am using a Raspberry Pi to detect certain colours in a webcam image. However, I can't seem to find any way to access the webcam using Python 3.X. Are there any libraries out there that work with python 3.X that work for both windows and linux (I'm creating the program on windows 7 but going to be using it on the R-Pi)?
If not, I suppose I could end up settling for Python 2.7 simply because the R-Pi has both versions installed on it (Although I don't know 2.7 so it may not go too well).

There are several ways to do this:
You can use OpenCV which has support for getting data from a webcam and there are Python wrappers for it;
gstreamer has python bindings too;
Also, on GNU/Linux, you can use v4l2.

Related

GPU rendering images with Python cv2 on Raspberry Pi

I am using the Raspberry Pi 2 to load large resolution images using opencv. I have sketch running, but without apparent "OpenGL" support as the opencv library states that it is not supported:
OpenCV Error: no OpenGL support (Library was built without openGL support)
I attempted to install pyOpenGL, but this had no effect. I am pretty new to graphics programming, so I'd take any suggestions on how to render to the GPU of the Raspberry Pi.
Ive stumbled across a Python friendly module that contains a GLSL API with quite a bit of examples :
http://pi3d.github.io/html/
You shouldn't need to deal with the gpu. Try following this blog, as it seems to have OpenCV install instructions. You might want to set INSTALL_PYTHON_EXAMPLES ON, but that is the only difference I could see.
Then you should be able to use it with python. If not, you may need to add it to your PATH.

Python 3 Webcam

im trying to make a face detection program and I need to access my webcam. Im strictly using python 3 for this project. I have tried OpenCv and video capture, but those only work for python 2.7. Is there any way that I can code this manually in python to,
A.use command line to do this,
Manually code this in python somehow, or
Any other modules(that work with 3).
Any help would be appreciated!
VideoCapture has worked really well for me in the past. The sourceforge page only shows support through python 2.7, but this page has pre-built installers through python 3.4. Simple, lightweight, and works.

Are there existing python bindings to the FlyCapture API?

I'm trying to write some code using OpenCV. My sensor is from Point Grey Systems, and it uses the FlyCapture API to grab images. I'd like to grab those images and do some stuff in OpenCV to them, using Python. FlyCapture is all C/C++, so I'm firing up SWIG to create the bindings. Am I reinventing the wheel? Do python bindings for FlyCapture already exist somewhere that I don't know about?
As of FlyCapture 2.11 there are official Point Grey / FLIR python wrappers. I've used the python 2.7 so far.
the pyflycapture2 is still available as well...
just started using this wrapper last week pyflycapture2
working well so far with my FireFly MV USB
Here's a new Cython wrapper I started for the FlyCapture V1 API:
https://github.com/kbrafford/pyfly1
It also has some wx.Python demos showing it working and allowing you to assess performance.
If the Python language is your only restriction, you may use the wrappers for FlyCapture from the JavaCPP Presets by calling the appropriate functions via Jython.

Why is OpenCV python crashing in Windows?

I am running OpenCV2.2 on Windows 7 64-bit.
I built OpenCV using cmake with MinGW 32-bit.
I have no problem with the C/C++ build. However the python bindings seem to have some problems. Most of the python samples are crashing.
The HighGui functions seem to cause trouble. Python crashes when I try to read an image (using imread, LoadImage or LoadImageM), display an image (imshow or ShowImage) or even create and manipulate windows (NamedWindow, MoveWindow, etc).\
WaitKey doesn't crash python but it always returns a -1 immediately, no matter how long the delay I provide. Similarly imgproc functionality listed under "Image Filtering" in the reference seem to crash python. I haven't been able to test it with too many other functions, mainly because I can't load in images and I am forced to test it with matrices i have built myself.
I am currently using python 2.6.6 (32-bit) , but I got the same problem with python 2.7 (32-bit). I also tried building the python wrappers for OpenCV2.1, and I got the same problem. It's very likely a problem specific to my setup. I've been cracking my head against this problem for quite some time now, I would appreciate any help.
Thanking you in advance.
Regards,
Anush.

Using Python for a Wacom tablet on Mac & Linux

I am shortly going to buy a Wacom Bamboo Pen&Touch, and I'd like to be able to access it from Python, preferably using PyQt. I've found a Python module for accessing it under windows (cgkit/wintab) and I've seen Python code for accessing it using GTK (GnomeTabletApps).
Is there an equivalent for Mac? The Cocoa documentation provided by Wacom is way beyond me.
PySide's QTabletEvent works on Mac. I have also used it on Ubuntu.
http://www.pyside.org/docs/pyside/PySide/QtGui/QTabletEvent.html#PySide.QtGui.QTabletEvent

Categories