Saturday 24 November 2007

How to configure webcam in Debian Linux

The friend of mine had been presented to me a webcam recently. On the box of Logitech QuickCam, there were logo of an alternative operation system, but in Debian configuration of a webcam is as easy as 1-2-3. Here are tips for configuration of a webcam.

Preparation
Some preparing words - if you didn`t compile your own kernel, this section can be omitted.
Webcam interface in kernel is almost like TVtuner - it is ordinary video device with /dev/video0 output. That`s why all articles about TVtuner configuration can help you as well. So, in kernel must be turned on:

  • v4l and all of it protocols (v4l monolithically, protocols - as modules)
  • i2c and it protocols (as well as during TVtuner configuration)
If it is enabled in kernel, you shouldn`t get any problems.


Installation
In the camera`s box was wrote: installation as simple as 1-2-3. So, I get pretty the same:

1. Installing software.
Instead of use of tonnes of proprietary garbage, let`s install from Debian repository:
sudo aptitude install gspca-source camorama
In the /usr/src directory, archive with driver source gspca-source.tar.bz2 will appear. Unpack it and change directory to /usr/src/modules/gspca and execute following:
make
Module must compile without errors. Next, do this:
sudo make install
This command will install your module in directory, were other kernel modules are placed. Optionally it can be executed:
sudo depmode -a
That`s itl, our goal is to load module of a webcam:
sudo modprobe gspca
Next step is to plug camera in USB and start the software.


2. Plugging the webcam
After you plug webcam into USB, it turns on green LED and in kernel logs should appear something like this:

usb 4-1: new full speed USB device using uhci_hcd and address 6
usb 4-1: configuration #1 chosen from 1 choice
/usr/src/modules/gspca/gspca_core.c: USB SPCA5XX camera found.(ZC3XX)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_probe:3887] Camera type JPEG
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:515] Sensor ID:7
/usr/src/modules/gspca/Vimicro/zc3xx.h: [zc3xx_config:597] Find Sensor HV7131R(c)
/usr/src/modules/gspca/gspca_core.c: [spca5xx_getcapability:1165] maxw 640 maxh 480 minw 176 minh 144
usbcore: registered new interface driver gspca
/usr/src/modules/gspca/gspca_core.c: gspca driver 01.00.04 registered

It looks like the webcam had been recognised. Now the device file /dev/video0 must appear - this is actually our camera. After that, webcam's soft should be launched:
$ camorama
If all was done correctly, you should see video in a small window of Camorama. It can be something like this:


3. Start using the camera
Now you can use your cam in Wengophone for video conference with friends and colleagues. It is need to say that image processing from webcam consumes processor time very moderate, around 4-5% on my Pentium M 1.75 GHz laptop.

Besides video conferences in VoIP, one can turn fantasy on and find many interesting applications to webcam. You may use it as security camera or telemetric device: streamer program can grab pictures from it with a prescribed frequency.


Conclusion
Except that there were mentioned only RedmondOS, Logitech QuickCam Messanger webcam works great in Linux, and configured in same three steps minus tons of useless proprietaty garbage.

During the tweaking I used these great guidelines because of my custom-made kernel. Those who use distribution kernel, this guide may be helpful.

I am very grateful to my good old friend :-) for presented webcam - thanks a lot!
Read more...

Saturday 17 November 2007

Yakuake - terminal in a Quake-style

When you use console in X-Window, often and often you desktop are literally wasted with xterms. It is more important, that you productivity is lowered, too. But here is solution - Yakuake.


Gamer`s console
When I was young, I spent pretty much time with CounterStrike and QuakeIII. And I felled in love with this small and elegant console hidden-in-a-top of screen in Quake. Till now, I was missing this feature on my desktop. But surfing in Synaptic recently, I found what I missed so much - Yakuake - and installed it immediately.


Tweaking is necessary
The main thing after installing Yakuake is tweaking. For comfort and productive work, you should customise Yakuake to yourself: keyboard shortcuts, theme, console hide duration and so on.

First step is to define for yourself with size of console: if it`s too small, you can`t see all that is written in console, and if it`s too large, it can overlap all of applications. I think that vertical size of 40% is fine for me - I can see everything in console and it don`t occludes other applications.

You can customize not only height of Yakuake console, but position on screen as well. It can be positioned in left, right on in centre. Of course, you can set position in procents precisely.

But the main thing in Yakuake are hotkeys. The work in console itself disposes to hotkeys and keyboard use, and properly configured hotkeys combinations can increase you productivity with Yakuake dramatically. There are not so much keys to customise, so tweaking don`t take so much time. By default you can call Yakuake by pressing F12 functional key, but you can redefine it to you choice.

Because Yakuake is very dynamic thing, only video can show it real capabilities, so I made short youtube film and here it is:




A little comment: first of all, film shows conventional work in terminal with xterms in X-Window, and they overlap each other. Then Yakuake is ran, and do the same stuff much more effective.

Links:

More about Yakuake can be readed here, there and here.

Read more...

Wednesday 14 November 2007

Quick PDF sorting and searching: SWISH++

Problem: using SWISH++ it is possible to search and sort PDF-files automatically
Solve: tools like pdftotext, find, scripts on Bash or Perl are required to perform quick and fast search within PDF and indexing PDF documents.

The common way is to use Beagle or some other searching stuff, but I show how SWISH++ can do the same, but much, much more fast and resource-efficient.


Introduction: How indexing within PDF
Perl-lovers likes to say that "there is more than one way to do it". So, that`s my way to do it. Briefly, solve consists from these steps:

  • use find to search all pdf documents and converting them to text with pdftotext tool
  • indexing this text files with index++ and getting index file
  • experimentally choosing level of relevant
  • searching in index file with keywords using search++
  • found files moving into required directory

Searching in PDF-documents and getting text from them

Simply asking find tool to search all *.pdf files and for everyone executing pdftotext in quiet mode. This can be achieved by command:
find -name '*.pdf' -exec pdftotext -nopgbrk -q {} \;
It is possible only for English, and other languages are not supported..

Making index file
Here it is even more simply: just ask index++ to index all of our textual files from current directory to the deep:
index++ -e "text:*.txt" .
Dot at the end is required!


What is SWISH++
There are a few mentions about SWISH++ in the Net - only homepage of project and article about application this system to real search engine. Some guys tells that SWISH++ is fastest search engine ever.
Description of this excellent search system can be found in debian package - Simple Document Indexing System for Humans: C++ version. Especially it is suitable for fast and efficient search engine.
Here are some advantages of SWISH++
  • Lightning-fast indexing
  • Indexes META elements, ALT, and other attributes
  • Selectively not index text within HTML or XHTML elements
  • Intelligently index mail and news files
  • Index Unix manual page files
  • Apply filters to files on-the-fly prior to indexing
  • Index non-text files such as Microsoft Office documents (antiword required)
  • Modular indexing architecture
  • Index new files incrementally
  • Index remote web sites
  • Handles large collections of files
  • Lightning-fast searching
  • Optional word stemming (suffix stripping)
  • Ability to run as a search server
  • Easy-to-parse results format
SWISH++ consist of two tools: index++ и search++. First tool indexing files, and second one searches within index. It`s like your personal Google, but small, fast and console. :-)


Indexing files
index++ make index file, which contains indexed text documents, made by pdftotext (oh, yea, UNIX-way!). It supports such formats as text, HTML, XML, LaTeX, mail - all that can be converted to text with may be little bit of tag-reached. On my desktop machine indexing is very fast: Intel Р4 630 3GHz with 2GB RAM indexing 270 in 5 seconds.

With level verbosity of 3, one can get more information about indexing process:
index++ -v3 -e "text:*.txt" .
Dot at the end is important, manual page can say more. Output will be like this:

watters_etal_paleobio_2001.txt (2704 words) WaveMetriconChip64.txt (1351 words) wshedtopoalgoJMIV.txt (4042 words) Ye.IJDAR.1.txt (4470 words) YucelITIP01.txt (1678 words) ./edg: morphology.txt (753 words) LuengoEtAl_IbPRIA05.txt (1227 words) Cuisenaire2005_1250.txt (1162 words) icpr2004_nucleus.txt (1234 words) OrtizEtAl_SPIE01.txt (1463 words) Angulo_VIIP04.txt (1658 words) 682.txt (1901 words) comorph.txt (1948 words) index++: ranking index... index++: writing index... index++: done: 00:05 (min:sec) elapsed time 548 files, 271 indexed 2465116 words, 1046139 indexed, 56281 unique
The result will be swish++.index file were are all information about indexed files.
Great: this huge collection of articles indexed so fast! Now we are ready to search something in it.


Searching files
Let`s find something in our collection of files with keywords. It is possible by asking search++ to find in database swish++.index. For example, I can search papers about morphology analysis of images but without mentions about medicine:

$ search++ morphology and erosion and dilation not medicine
And here are results (output is reduced):
# results: 125
99 ./Krylov2.txt 3771 Krylov2.txt
49 ./13300407.txt 3103 13300407.txt
46 ./morph1.slides.printing.6.txt 4369 morph1.slides.printing.6.txt
37 ./lecture_morphology_sara.txt 6746 lecture_morphology_sara.txt
30 ./SIGGRAPH2002_Sketch-Mitchell.txt 5308 SIGGRAPH2002_Sketch-Mitchell.txt
26 ./MorphologicalImageProcessing.txt 7642 MorphologicalImageProcessing.txt
25 ./phdsymp2002_ledda.txt 8298 phdsymp2002_ledda.txt
23 ./lab2_manual.txt 9313 lab2_manual.txt
23 ./Project 1.txt 9946 Project 1.txt
22 ./morphology.txt 11212 morphology.txt
22 ./edg/morphology.txt 11212 morphology.txt
22 ./slides-6-geometry.txt 11717 slides-6-geometry.txt
22 ./V1BFOGG8.txt 10797 V1BFOGG8.txt
18 ./71650638.txt 13978 71650638.txt
First column is relevantness, second - relative file placement, third - file size, and fourth - name. Simple and clean. So it`s very simple to search article if you remember something about it (author name, keywords, or even phare from it).


What we get
I have vast collection of science articles in English, and it`s very hard to remember exact name and content each of paper. Using this approach, I had sorted more than 2400 papers in about 2 hours. Task for SWISH++ was more difficult because of homogeneity of paper`s content. Precision was estimated as approximately 60-70%. Of course, sorted papers had been viewed by me, so it was semi-automatic-alike mode ;-)


Links: I can`t say all about this shiny search system in one post, but I tried to show how quickly and easily I working with loads of PDFed articles in my Debian box.
For further information, you may be interest in sourceforge page of project. Here are many articles aobut search engines, and, particularly, about SWISH++, and documentation about SWISH-e is here. I hope that with this post, there will be one more article about this very useful system - SWISH++.
Read more...

Saturday 3 November 2007

XMMS: Just play music

There is an interesting class of programs: audioplayers. What we expected from them? Playing music. What is required for this? Codecs, simple interface, playlist, equalizer. May be themes and control from keyboard. Many things can be applied to it, but audioplayer must stay a-music-player. This is primary task for such kind of program, and afterwards - cataloguer, tag converter, music collection organizer and so on. For this, spartanians and ancient-lovers remembers and likes simple yet powerful XMMS.



There is many a good tune played on an old fiddle...
This strings are being written in hope that there are still stayed people, who needs the only music playing from audioplayer. Without bells and whistles, and without dependencies from half of KDE and quarter of GNOME. And there is a honest hero, in an old GTKish arms, which is in Debian distribution from old times - xmms. Fast, simple, without bells and whistles, all necessary features and with support of all common formats. Here it is on a screenshot:



It`s strongly WinAmp-alike, which had been used by anybody in some less-knows operation system from Redmond. Without loads of pretties, but with themes (which there are enormous in Debian distribution), equalizer and playlist. If you don`t look you you audioplayer permanently, there is no more needed. XMMS is configured by menu, which is very WinAmp-like:



Many features can be configured here... Audio output method, codecs, startup behaviour, fonts...

After that, music can be copied into directory, and tags can be converted by another software, such as EasyTag. I like XMMS for incredibly speed of loading songs with tags: more than 400 music files are loaded with less than 6 seconds with alphabet sorting. And I`m don`t remember about it anymore - XMMS is minimized to tray and controlled by multimedia keyboard.

Plugins
Searching in repository with combination

# apt-cache search xmms-
gives pabulum for reflection:
xmms - Versatile X audio player that looks like Winamp
xmms-festalon - XMMS Input plugin for playing NSF music files
xmms-liveice - XMMS plugin that sends your audio to a shoutcast server
xmms-alarm - xmms general plugin for using xmms as an alarm clock.
xmms-arts - aRts Output plugin for xmms
xmms-blursk - Powerful visualization plugin for XMMS, similar to "Blur Scope"
xmms-bumpscope - visualization plugin for XMMS that appears as an embossing oscilloscope
xmms-cdread - Input plugin for XMMS that reads audio data from CDs
xmms-crossfade - XMMS Plugin for Crossfading / Continuous Output
xmms-dbmix - XMMS output interface to the DBMix audio system
xmms-defx - A Sound alterator plug-in for xmms
xmms-dev - XMMS development static library and header files
xmms-finespectrum - XMMS Fine Spectrum Analyzer Plugin
xmms-flac - Free Lossless Audio Codec - XMMS input plugin
xmms-fmradio - FM Radio input plugin for XMMS
xmms-goodnight - XMMS plugin to stop playing at a given time
xmms-goom - visualization plug-in for XMMS with a variety of effects
xmms-infinity - full-screen visualisation effect for XMMS
xmms-infopipe - General plugin for XMMS, reports real-time information to a pipe
xmms-iris - advanced OpenGL visualization plugin for XMMS
xmms-jack - xmms output plugin to the jack audio server
xmms-jess - visualization plugin for XMMS using various 2D and 3D methods
xmms-kjofol - XMMS remote that uses K-Jofol's skins
xmms-kjofol-skins - Skins for the xmms-kjofol package
xmms-ladspa - power XMMS with the Linux Audio Developer's Simple Plugin API
xmms-lirc - Linux Infrared Remote Control for XMMS
xmms-mad - mp3 input plugin for xmms based on libmad
xmms-modplug - ModPlug plugin for XMMS
xmms-msa - spectrum analyzer plugin for XMMS with skin support
xmms-osd-plugin - XMMS plugin using xosd
xmms-qbble - XMMS playlist manager with search support
xmms-rplay - RPlay Output Plugin for XMMS
xmms-shell - XMMS Shell - Interface to control XMMS from the Console
xmms-sid - Input plugin for XMMS that plays SID (C64) tunes
xmms-singit - Display and edit lyrics with XMMS
xmms-skins - Skins for XMMS
xmms-stats - Make stats of your preferred songs
xmms-status-plugin - Status panel applet for XMMS
xmms-synaesthesia - visualization plugin for XMMS with a field of glowing lights
xmms-volnorm - XMMS plugin that gives all songs the same volume level
xmms-xf86audio - XF86Audio multimedia-key support for XMMS
xmms-coverviewer - XMMS plugin that displays covers while playing
xmms-find - XMMS plugin for quick, remote jump to another song
xmms-jackasyn - JACK Output plugin for xmms
xmms-kde - MP3 player integrated into the KDE panel
xmms-mpg123-ja - mpeg123 plugin supported Japanese encodings for xmms

So, that`s why XMMS is versatile. There is no need to install all plugins, but some of them are payed attention:
  • xmms-cdread - for AudioCD reading.
  • xmms-crossfade - makes song to be faded slowly at the end and at the beginnig.
  • xmms-flac - support of FLAC sound format.
  • xmms-skins - this package consists of themes, so you should install it.
  • xmms-status-plugin - permits to control XMMS, when it minimized to tray.
  • xmms-xf86audio - controlling XMMS via keyboard: now multimedia keys on keyboard will be played in full power!
There are more plugins - xmms can be tweaked for your comfort simply.


...but that`s fiddle can`t play hardrock
Of course, XMMS have contras - there no silver bullet. GTK1 menus are so ugly, that Compiz\Beril-lovers can harm their gentle psychology.
But, as mentioned earlier, you wanted simple yet powerful player? Here it is! And it`s better than looking at Ubuntu dialog box "for music playing, loads of codecs are required". And here it`s playing and singing.


Conclusion
This post was inspired by questions on forums. And dear commentators, don`t throw addle vegetables in me: I really like XMMS, like MC.
Read more...