gspylogo

Using Gspy with Non 640x480 Cameras

eyeball


 
 

The following info was received from Phillip Coombs Feb 23/2001...

Having recently bought and setup a USB webcam to use with Linux as a traffic cam, I've now spent a couple of days playing with everything to do with webcams that I can. I cam across GSpy and gave it a go but unfortunately though it compiled, it crashed and burned on execution. I've traced the problem and thought I'd let you know what it was. Basically it was is that GSpy assumes 640x480, as you mention in the docs, and my camera is 352x288 (it's a cheap ZoomCam). In the end I've changed the code to handle this and thought I'd let you know in case you want to integrate it in the main stream. Basically what I've done was to change the DEF_HEIGHT and DEF_WIDTH #defines in v41if.h to be the values I've got, but then also changed all occurances of 640 and 480 in the code to use those defines. In addition to that, all values dependant on those values such as 320, 319 and so on I've also changed to be derived from the #defines. Thus simply changing the DEF_WIDTH and DEF_HEIGHT defines in one header will do all the necessary changes for cameras with different dimensions, rather than having to search for 640 etc everywhere. I think 95% of the changes were in callback.c, one or two were in interface.c and one was in gspy.glade (which I did have to change to a hard value since I'm not really familiar with Glade but you may be able to overcome that). I guess in an ideal world you would read the dimensions from the camera itself and adjust it dynamically. However just doing and documenting the above changes maybe will quickly help other people who want to use your program (which is _extremely_ neat) but who have cameras that aren't 640x480. Cheers, and keep up the excellent work. Phil



Tom writes:
Hi, I have a very cheap USB Dexxa 352*288 webcam. It works with the driver from http://qce-ga.sourceforge.net/ Honestly, I'm not a C of C++ programmer (I once started it, I'm still interested in it, but I don't know a lot about it). But the nice thing is that I was able to update the source after I read the comment of Phillip Coombs. It now works very nice with my Dexxa webcam. I don't know if this patch is 100% correct, I only tested is by gunzipping the gspy archive in another dir and applying the patch to it, and that worked. These are a few comments you may publish on your site about the patch. if there are spelling mistakes in them, it's because English is not my primary language. If you have a 352*288 webcam you can gunzip the gspy-0.1.5-src.tar.gz file with

$ tar -zxf gspy-0.1.5-src.tar.gz 

and also gunzip the patch with 

$ gunzip gspy-352x288.patch.gz 

then apply the patch 

$ patch -p0 < gspy-352x288.patch 

now descend into the gspy dir with 

$ cd gspy 

and do the usual: 
$ ./configure 
$ make 

(you might need to change to root) 
$ su 
(password) 
# make install 

This should work fine! 

If you have another resolution, you can easily change it in 'src/v4lif.h' 

you should change then all these lines (which isn't very difficult): 

#define DEF_WIDTH    352    //width of webcam input 
#define DEF_HEIGHT    288    //height of webcam input 

#define DEF_SW    176    //half of the width of webcam input 
#define DEF_SH    144    //half of the height of webcam input 
#define DEF_SWM    175    //half of the width minus one 
#define DEF_SHM    143    //half of the height minus one 
#define DEF_WM    351    //width minus one 
#define DEF_HM    287    //height minus one 

Greetz, Tom (tomNO_SPAMMERS@startgids.be) 

gspy-352x288.patch.gz(4545 bytes).
gspy-0.1.5-src.tar.gz(200008 bytes) .


SourceForge Logo

to home page
To Gspy Homepage