The GUVCViewer provides "a simple GTK interface for capturing and viewing video from devices supported by the linux UVC driver".
Introduction.
This project aims at providing a simple GTK interface for capturing and viewing video from devices supported by the linux UVC driver, although it should also work with any v4l2 compatible device.
The project is based on luvcview for video rendering, but all controls are build using a GTK2 interface.
You can also use guvcview (since version 0.9.9) has a control window only, (from console: guvcview --control_only), this allows image control on other apps, like ekiga, cheese, mplayer, skype,ecc.
Audio.
Guvcview audio support is based on the portaudio library, up until version 0.9.3 the blocking API was used for audio capture, since version 0.9.4 the callback method is used instead, this provides better performance, it is also the preferred method for the portaudio API.
All interfaces (ALSA, OSD, JACK, ...) supported by portaudio should be available in guvcview. Just make sure portaudio was compiled with the desired interfaces enabled.
UVC Dynamic controls.
The linux UVC driver has an implementation for extension controls (these are vendor specific controls and are supported in the UVC spec.), they are called dynamic controls since they must be dynamically loaded into the driver.
Until today only logitech has supplied specs for their UVC webcam extension controls, these are supported by guvcview.
In new driver revisions admin rights are needed in order to add these controls to the driver, so there are basically two solutions:
1- start guvcview has root (sudo for debian/ubuntu) at least once per session, since version 1.2.0 you can do this with the option --add_ctrls avoiding the need to fully launch guvcview
2- install libwebcam this software has a udev script that should add the necessary controls to your logitech camera.
Download:
Guvcview can be downloaded from the project page at sourceforge in two forms:
A source code tarball (tar.gz) or debian package (.deb)
Ubuntu users can use my repository at launchpad, just add it to your system software sources:
sudo add-apt-repository ppa:pj-assis/ppa
now just update it:
sudo apt-get update
You should now be able to install guvcview with sudo apt-get install guvcview.
The latest development revision is also available through svn.
It enables access to far more camera parameters than v4l2ucp, especially image resolution
Here is how I use the panels, to capture still images:
Since I am not going to make a video with an audio track, I do not use the audio panel at all. And I do not actually use the video panel when capturing still images, but it is appropriate to note that some of the controls for capturing still images are on the video panel. For example: the image resolution control and the specification for a base name (and directory) for the image file(s).
[NOTE to maintainers of the 'guvcview' program (Nobuhiro Iwamatsu - iwamatsu at debian dot org, in 2010 ---- or to documenter Paulo Assis - pj.assis at gmail dot com): The organization of those options should be changed. Either move them to the Image Control panel --- or move the resolution control to a new panel that provides controls that are applicable to both still image capture and video image capture.]
Once I get the image lined up - with magnification, focus, and brightness set - I simply click on the 'Cap. Image' button at the bottom of the 'GUVCViewer Controls' window.
I have it set so the image goes into a subdirectory of my home directory called 'MICROSCOPE' --- usually with a filename like 'Image-3.jpg'. I navigate to that directory (using the Nautilus file manager, available in Ubuntu Linux) and right-click on the filename to select an application to edit the image file.
I like to use an image processing program called 'mtpaint' to crop the file --- and, if necessary, adjust the brightness of the image using the 'Gamma correction' option of the 'Transform colors' option in 'mtpaint'. You can also do things like 'invert' the image to change a dark-on-light image to a light-on-dark image. I have started a web page with helpful hints on how to use 'mtpaint'.
You will typically also rename the file and move it to an appropriate directory.
Launching 'guvcview' :
To startup 'guvcview' so that it recognizes the USB microscope (instead of a web cam or other video device) --- and so that it is ready to take still images rather than video, I made a startup script called 'guvc.sh'.
I will describe the script contents in another section below. You can simply highlight and paste that code into your own script file on your own Linux computer.
When one has the script file ready, it is easy to make an icon on your desktop to launch the script --- which immediately brings up the 'guvcview' control panel window and the viewport window. The viewport window immediately shows the image that the microscope is capturing.
(The following images, that show how to make the desktop icon, were captured on an Ubuntu 9.10 PC, using the Gnome desktop environment.)
You simply right-click on the (Gnome) desktop and choose the 'Create Launcher ...' option from the popup menu. Here is an image of that popup menu.
When you choose 'Create Launcher...', you are presented with this Create Launcher panel, in which you enter a name for your icon and the fully-qualified name of the script file that you want to launch by double-clicking on the desktop icon.
Here is the help that you get for 'guvcview' by entering the command 'guvcview -h' at a command prompt in a terminal window on Linux:
$ guvcview -h
guvcview 1.1.1
Usage:
guvcview [OPTION...] - local options
Help Options:
-?, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options
GTK+ Options
--class=CLASS Program class as used by the window manager
--name=NAME Program name as used by the window manager
--screen=SCREEN X screen to use
--sync Make X calls synchronous
--gtk-module=MODULES Load additional GTK+ modules
--g-fatal-warnings Make all warnings fatal
Application Options:
--version Prints version
-v, --verbose Displays debug information
-d, --device=VIDEO_DEVICE Video Device to use [default: /dev/video0]
-o, --control_only Don't stream video (controls only)
-g, --config=FILENAME Configuration file
-w, --hwd_acel=[1 | 0] Hardware accelaration (enable(1) | disable(0))
-f, --format=FORMAT Pixel format(mjpg|jpeg|yuyv|yvyu|uyvy|yyuv|yu12|yv12|gbrg|grbg|bggr|rggb)
[NOTE: Had to use 'jpg'. 'jpeg' is not accepted. Gives error.]
-s, --size=WIDTHxHEIGHT Frame size, default: 640x480
-i, --image=FILENAME Image File name [Defalt name = 'Image.jpg' or 'Image-N.jpg'
-c, --cap_time=TIME Image capture interval in seconds
-m, --npics=NUMPIC Number of Pictures to capture
-n, --video=FILENAME Video File name (capture from start)
-t, --vid_time=TIME Video capture time (in seconds)
-p, --show_fps=[1 | 0] Show FPS value (enable(1) | disable (0))
-l, --profile=FILENAME Load Profile at start
--display=DISPLAY X display to use
As a further note on the run-parameters of 'guvcview':
I found that the 'guvcview' program saves its default run parameters (and changes that you make to them when you use the program) in 'rc' (run control) hidden files in your home directory. In fact, for a video device assigned to /dev/video0, 'guvcview' creates a '.guvcviewrc' file. And if there is a second video device assigned to /dev/video1, 'guvcview' creates a '.guvcviewrc-video1' file.
In my case, the /dev/video0 device corresponded to a USB webcam -- a Logitech C500. And the /dev/video1 device corresponded to the Veho USB microscope.
For easy reference, here is a sample image of a '.guvcviewrc-video1' file which corresponded to the Veho VMS-001 USB microscope.
For completeness, here is a sample image of a '.guvcviewrc' file which corresponded to the Logitech C500 webcam.
I see that, in the '.guvcviewrc-video1' file, there is a 'sound=' parameter that can be set to 0 or 1. There does not seem to be such a parameter option via the guvcview command line options. It would be handy to specify something like '-a 0' to indicate that no sound recording is wanted. The initialization messages coming from 'guvcview' indicate that it spends a little processing time, during startup, trying to determine if sound recording should be done.
Here is a sample of 'guvcview' messages from when the program starts up. Note that there are four
'bt_audio_service_open: connect() failed: Connection refused (111)'messages at the beginning, indicating that the progam is trying to setup sound recording.
Screenshots.
0 comments:
Post a Comment