Webcam capture in Python 3.4 on Windows - python-3.x

I have seen different modules like OpenCV and Videocapture for taking fast shots from the computer webcam, but these are only for Python 2. I thought I would make one work with Pygame, but I got many errors. I found different pages including pygame's website that said it only works with Linux.
Are there any modules for Python 3.4 for Windows that can quickly take shots from the webcam?

OpenCV can apparently be installed on Windows with Python 3, according to this answer here.
After OpenCV, my 2nd recommendation is to use GStreamer, and this is apparently possible on your specific platform according to this answer.

Related

Where or what are the instructions for installing FMOD Ex for Linux to use in g++?

This isn't really a programming question per se, but it is related. I'm looking for the instructions on how to install FMOD.
I want to do extra credit for my computer graphics assignment - sound effects. A teammate wants me to go with something simple, and he suggested that I use FMOD Ex. (If you guys can think of something better, do suggest it, but so far FMOD looks more promising compared to SDL, OpenAL, etc.)
Right now I'm having a really hard time finding the instructions for installing the latest version of FMOD (audio content creation tool) on Linux Ubuntu 12.04 LTS (32-bit) so that I can use it in g++ with OpenGL. I checked out this YouTube video: http://www.youtube.com/watch?v=avGxNkiAS9g, but it's for Windows. Then, there is a Ubuntu Forums thread which redirected me to this page: https://wiki.debian.org/FMOD, and it has some dated instructions. I've downloaded FMOD Ex v. 4.44.24, which I believe is the latest version. Now I'm looking at eight libraries: libfmodex.so, libfmodex64.so, libfmodex64-4.44.24.so, libfmodex-4.44.24.so, libfmodexL.so, libfmodexL64.so, libfmodexL64-4.44.24.so, libfmodexL-4.44.24.so ... not knowing what to do. I've looked everywhere I could think of: here, YouTube, Google, Ubuntu forums, ... and came up with zilch. I can't think of any other place to ask this question.
If you do know how to install FMOD off the top of your head, drop me a line.
Please help. Thanks in advance.
Copy the .so files in /usr/local/lib/, the header files in /usr/local/include/fmodex/, and you're good to go.

Cross-platform way to play audio files (mp3, wav, etc... ) on Python 3?

I'm searching for a library (preferably cross-platform) that lets me play various audio files on Python 3 (currently using 3.3.0).
I have tried several options such as Pyglet but it doesn't run on Py3 (I tried the alpha, which SHOULD have Py3 support).
Is there any library ported to Python 3 yet?
Thanks.
You can use PyQt4 with Python 3. Qt provides powerful cross-platform multimedia framework.
http://www.riverbankcomputing.co.uk/software/pyqt/intro
Here is playing a sound with QtMultimedia example written for python 2, but it is not difficult to adopt it to python 3. Only be sure, that pyqt4-python3 or similar is installed on your system.
Here is a QAudioOutput class, which solves your problem.

python3 audio signal processing

A project I am working on for one of my classes is to build a simple GUI sound editor for kids using python3 (using python3 is a strict project requirement). I don't want this editor to be as complex as something like audacity but I would like to have some fun built in effects similar to the sound editor on the nintendo ds http://nintendo.wikia.com/wiki/Nintendo_DSi_Sound.
I have been researching modules that are compatible with python3 that will help with the audio signal processing since I am very inexperienced in this area but I am running into trouble finding something that will work with python3. I found this great list of music modules for python: http://wiki.python.org/moin/PythonInMusic but everything that seems to have the functionality I think I want such as pyo and snack, does not have python3 compatibility.
I think at this point my best option is to use NumPy and SciPy for the signal processing but I was wondering if anyone had any better suggestions or advice? Or is using NumPy and SciPy an ideal choice if I can become familiar with them?
NumPy/SciPy can process audio signals, but it doesn't feel "native" as you have to write lots of interface code to play the resulting data as sound or write the in some standard format (like .wav).
I'd suggest porting those modules ; it's often very easy and straightforward and a good Python exercis.

Grabbing Images from a Webcam to be used with OpenCV

This is a follow up to my previous question,
OpenCV PS 3 Eye
Can someone suggest a library that would allow me grab frames from camera without too much fuss (like video videoinput lib for windows) and pass them to opencv within my application?
I had a parallel problem using a completely different webcam: worked well in cheese/etc, v4l-info showed proper setup, but openCV would fail with:
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor
After much flailing I found that at least one guy had similar problems with webcams in various applications.
In blind faith I promptly punched in export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and «poof» it worked.
The openCV v4l2 interface is not as robust as the v4l implementation and the export is a quick workaround (openCV appears to revert to v4l).
With a quick browse of opencv/modules/highgui/src/cap_v4l.cpp it would appear as though openCV would like to use v4l2.
I'm running Ubuntu Lucid 2.6.32-28-generic x86_64, libv4l-0 v0.6.4-1ubuntu1 with openCV pulled from the HEAD of the repo a few days ago.
In the course of explaining this I've resolved my issue. It turns out that openCV forces the resolution on a v4l2 device to 640x480 by default - and my device had a max 320x240 resolution which caused the fault when testing for the format type in opencv::highgui::cap_v41::try_palette_v4l2. I changed DEFAULT_V4L_WIDTH and, DEFAULT_V4L_HEIGHT.

OpenCV 1.0: cvCreateFileCapture Always Returns Null under Fedora 11

I'm attempting to open a video file using openCV 1.0's highgui.cvCreateFileCapture(path) function on a Fedora 11 system. Unfortunately, this function is always returning null. I've attempted to use it on a few different video formats, and I've even taken the steps recommend on the openCV wiki (http://opencv.willowgarage.com/wiki/VideoCodecs) to use mencoder to transcode to RAWI420 as follows:
$ mencoder in.avi -ovc raw -vf format=i420 -o out.avi
This has seemed to have no effect, so I'm a bit stuck. No error is produced, null (or, since I'm using the python wrapper, None) is returned. I have ffmpeg, ffmpeg-devel and ffmpeg-libs installed so I think I should have appropriate codec support. Does anyone know how this could be resolved, or in lieu of a resolution, what steps could be taken to debug the issue?
I was having this problem on Ubuntu 10.10, and for me it was a problem with the libraries. I couldn't find out which library was the one that was missing, but I discovered that executing the installation scripts for Openframeworks before compiling OpenCV worked!
It depends on how you installed OpenCV. OpenCV can use one of many different engines for reading video files, including ffmpeg, gstreamer, and xine (I believe). Make sure that your installation is indeed using ffmpeg as the engine. The easiest way I can think of to do this is by calling "ldd programname" and seeing if ffmpeg is listed as one of the dependencies. Furthermore, you need to make sure that the engine is capable of processing your video codec.
OpenCV is unfortunately very quiet about what causes errors. Returning NULL could mean, "unable to handle codec", and it could mean, "access denied". You could run your process through strace and see what the system calls are returning as one possible option. Worst case scenario, you'll need to use a debugger and walk through the code as you call cvCreateFileCapture. Hope this helps.
OpenCV is already on version 2.x
Do yourself a favour and update it to version 2.1 (at least)

Resources