1 of 9
1
[Tutorial] PS3 Eye Working on Linux
Posted: 11 January 2009 08:38 PM   [ Ignore ]
Rank
Joined  2008-12-31
Total Posts:  37
New Member

There seems to be a lot of interest in this little wonder of a webcam, but there is not much clear information on making it work (other than AlexP’s excellent work on Windows).

First off, my testing environment. Running Ubuntu 8.10 AMD64 with a custom kernel. Note: the standard issue model should do just fine, mine is trimmed down and optimized for my processor. These instructions should apply just fine to other distributions, but you will have to modify the commands accordingly (such as using root instead of sudo, and your package manager). I am going to assume that you have a basic knowledge of the terminal and all necessary build tools installed ("sudo apt-get install build-essential” on Ubuntu).

Now, on to the fun stuff. Thanks to a group on Linuxtv.org, we have a nice new V4L driver available for this. The first step is to install ‘hg’ (included in the “mercurial” package on Ubuntu), and download the latest version of said driver:

sudo apt-get install mercurial

hg clone http://linuxtv.org/hg/~jfrancois/gspca/

You should have a folder named “gspca” in the current terminal directory. Now we want to change into that directory and begin the build process:

cd gspca

make

At this point, make might complain about any number of things. You will want to check and make sure it is installing for your *current kernel* (check with “uname -r” if you are unsure). That is the biggest issue. If it complains about something else, post here and I or someone else will try to help as much as possible. If your build is successful, go ahead and install it:

sudo make install

You should now have a patched V4L installed, and the driver should be working. Let’s go ahead and test this. Change into the test programs directory (assuming you are still in “gspca"), and build the driver test file:

cd v4l2-apps/test/

make driver-test

Now plug in your camera, and it is time to see if the driver install worked.

./driver-test

. This should produce an output string with information about the file format, and what is being transferred, etc.. If it says “no /dev/video*”, make sure the camera is plugged in. It seems to autodetect the proper video device, so other cameras or video capture cards shouldn’t be a problem.

If you have made it this far, congratulations. Time to see some actual results in video form. Install one of the configurable video programs (Mplayer, VLC, Xawtv, etc..). VLC is probably the easiest to use here so:

sudo apt-get install vlc

Open VLC, then go to Media > Open Capture Device. In the configuration window, set it to V4L2, video device: /dev/video0, audio device: /dev/audio1. Your video and audio devices may be different, this assumes no other video inputs and one audio input (motherboard mic input in my case). In a second or two, you should see some nice 640x480 video in proper color, and the audio should be working. This concludes this part of the install process, as I haven’t yet tried anything further myself (will test tbeta and some other programs soon and report back).

The problems seem to be: jumpy video, and VLC crashes if custom settings are used (e.g. for resolution and framerate). The occasional jumpy video can be blamed on the huge amount of raw video data being processed, and I am still looking into the custom settings problem. I imagine that as drivers for this camera progress, performance will too.

This concludes my tutorial, I hope it helps some. Please feel free to chime in with any questions or comments.

[edit] Oops, almost forgot to give credit. I had nothing to do with developing drivers, the guys at linuxtv.org (specifically “jfancois”, but I am sure there are others) took care of that. Getting it to work was largely thanks to excerpts from the PS2 Dev forums, specifically “jimparis” and “ao2”. Thread: http://forums.ps2dev.org/viewtopic.php?t=9238&postdays=0&postorder=asc&start=0

Profile
 
 
Posted: 11 January 2009 09:09 PM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

Thanks for posting this here!  I am not the creator of the driver either, but I am working on a fix to get it to work up to full 120FPS.  Does unicap recognize the camera for you?

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 12 January 2009 01:06 AM   [ Ignore ]   [ # 2 ]
Avatar
RankRank
Joined  2008-01-05
Total Posts:  163
Member
vw_kubel - 11 January 2009 08:38 PM

There seems to be a lot of interest in this little wonder of a webcam, but there is not much clear information on making it work (other than AlexP’s excellent work on Windows).

Many thanks for great tutorial.

Would you like to post this to our wiki, so it doesnt get buried in the darkness of forum? grin Opening a new page from the main page, and linking it from http://wiki.nuigroup.com/Documents_and_tutorials would suffice.

Best
Görkem

Profile
 
 
Posted: 12 January 2009 09:23 PM   [ Ignore ]   [ # 3 ]
Rank
Joined  2008-12-31
Total Posts:  37
New Member
xelapond - 11 January 2009 09:09 PM

Does unicap recognize the camera for you?

I’m having trouble with this step at the moment. On the plus side, I have tbeta running (no video in) with Ubuntu 8.10 64bit. It gives the error: Unicap : Error selecting device 1. It does pick up the camera at /dev/video0 and set 640x480, so halfway there. Running ucview in a terminal, it picks up the camera fine, but crashes with: ucview: symbol lookup error: ucview: undefined symbol: ucil_audio_list_cards, when I tell it to load the camera. Still looking for some ideas here, these programs are a little tricky to figure out problems. I’m thinking the two are related, so if I can figure out the symbol lookup problem, hopefully tbeta will work right.

gorkem: Thanks, and I’ll get to work on a wiki entry for this. Never tried writing a wiki page from scratch before, but it doesn’t look very hard.

Got a little farther compiling unicap-0.9.3 and ucview-0.22 from scratch. UCview works, but gives a yellow picture (no image from the camera) and says “failed to start video capture”. Not much of an error to go on, but maybe something will turn up…

Profile
 
 
Posted: 14 January 2009 08:34 PM   [ Ignore ]   [ # 4 ]
Rank
Joined  2008-12-31
Total Posts:  37
New Member

Sorry for the double post, just a quick update on unicap.

I installed opencv (for use with touchlib). Its included demos are able to talk to the camera properly through unicap, and display a picture. I haven’t tested this a whole lot, but it works. So I know somewhere in here there has to be a trick to getting the Eye to play nice with the other programs.

The drivers for the Eye are still a little buggy, while it works, it freezes for ~3 seconds every ~30 seconds. This seems to happen on all display programs, resolutions, and frame rates. I’m still thinking that this is a USB issue, that the driver interface there lags some (or maybe not, since the freezes aren’t consistent). Any thoughts on this?

Profile
 
 
Posted: 18 January 2009 12:18 AM   [ Ignore ]   [ # 5 ]
RankRank
Joined  2008-12-10
Total Posts:  209
Member

It appears that the gspca-ov534 driver was rolled into v4l in the 2.6.28 linux kernel recently - I just picked up a PS3eye, building that kernel now.  Will post with results of tests shortly wink

[edit] Someone’s random PS3 linux blog lied to me! smile

The driver is available in the 2.6.29-rc2 release candidate, trying to build that one now.

[edit2] Confirmed that the included driver in 2.6.29rc2 seems to work ok for apps such as luvcview, however tBeta on this machine gets nothing at all from the cam, and I can’t seem to change any properties of the device or select any resolution other than 640x480.. however I get a nice, crisp, fast image from the cam smile

 Signature 

22” LLP-LCD ftw
TUIO Smoke (Windows / Linux) - http://projects.edencomputing.com/projects/tuiosmoke

Profile
 
 
Posted: 18 January 2009 08:28 AM   [ Ignore ]   [ # 6 ]
Rank
Joined  2008-12-31
Total Posts:  37
New Member

That’s very good to know, thanks for the update! I’ll definitely be trying out the new kernel today.

Maybe we can get some more progress with unicap and tbeta with this too.. Unicap does pick it up with other programs, so it is just a matter of figuring out where the problem is exactly.

Profile
 
 
Posted: 18 January 2009 08:42 PM   [ Ignore ]   [ # 7 ]
RankRank
Joined  2008-12-10
Total Posts:  209
Member

I’m not getting the freezes vw - video is nice and smooth for me, if a little grainy.  Certainly could be cleaned up if there was any access to the camera brightness/contrast/exposure controls.

I’ve got touchlib working with the cam fairly well, but I’m getting a lot of false blobs when my overhead light is on, looks like auto whitebalance is triggering once every few seconds (maybe this has something to do with your freezes?)

The current driver defaults to a framerate of 30fps, but supports 50fps without a hitch - the trouble is that without being able to specify otherwise, programs like touchlib are using the default 30fps.  I’m trying to recompile the module right now with the default set to 50fps.  If it works it’s an easy change smile Will post results shortly.

[edit] No such love.. though I’m able to set the framerate to 50fps as the default, luvcview and touchlib are both still hitting 30fps.  If I force 50fps now, video is very jittery and not nearly as smooth as previously :(
This driver needs a bit of TLC before it’ll be really useful I think.. being able to set parameters and use a frame resolution other than 640x480 would be a good start.. this cam is just *too* good not to get it working up to par, but as my first kernel-hacking attempt this might be a little beyond my current skills wink

 Signature 

22” LLP-LCD ftw
TUIO Smoke (Windows / Linux) - http://projects.edencomputing.com/projects/tuiosmoke

Profile
 
 
Posted: 23 January 2009 01:22 PM   [ Ignore ]   [ # 8 ]
RankRank
Joined  2008-12-10
Total Posts:  209
Member

So after playing with the Eye in Windows a bit, and seeing the awesome potential of this cam in action, I’d like to see it working as well in linux even more.

My C skills are lacking hard, and I know even less about coding device drivers in linux, but I’m learning slowly. 

If anyone else is taking a crack at hacking the driver (or writing your own), this info might be useful: 

i2c driver for the ov772x chipset - this driver contains a fairly complete list of registers for the ov772x, the same controller used by the PS3 eye.

For our needs, we probably don’t want to use the i2c interface - v4l2 is a much better place to talk to the cam I think, but these registers should hopefully translate well.

My checklist for things I’d like to see working in the gspca driver (or otherwise, if gspca turns out to be a bad place for this cam):

1) Resolution control - this is most important, currently we’re stuck with 640x480, would love to see the 320x240@60fps+ working

2) Better framerate support - so far all I’ve been able to request is 30fps or 50fps, which leads to

3) Gain/Exposure control - because even specifying 50fps, AWB/auto exposure drags the framerate down closer to 20fps at the most :(

4) Flicker control - since not everyone uses 60hz power sources, it would be nice to be able to switch (getting rid of the ‘scanlines’ present now)

Time to brush up on C and do some research for me wink

 Signature 

22” LLP-LCD ftw
TUIO Smoke (Windows / Linux) - http://projects.edencomputing.com/projects/tuiosmoke

Profile
 
 
Posted: 23 January 2009 04:10 PM   [ Ignore ]   [ # 9 ]
Avatar
Rank
Joined  2008-12-02
Total Posts:  31
New Member

I have made a lot of test with the Ps3eye on Linux and with some usb sniffer on windows
Sniff usb and tweak register values in gspca driver again and again.

We can now use the PS3eye with more resolution and frame rate :

EDIT 12/02/2009: (thanks to Seth (cerupcat) for his remark about my wrong fps reports)
The working modes are :

00: 640x480@15
01: 640x480@30
02: 640x480@40
03: 640x480@50
04: 640x480@60
10: 320x240@30
11: 320x240@40
12: 320x240@50
13: 320x240@60
14: 320x240@75
15: 320x240@100 (added 15/02/09 V0.3)
16: 320x240@125 (added 15/02/09 V0.3)

See here for the files (updated 12/02/2009) :
http://kaswy.free.fr/?q=node/42
It is based on the gspca driver, and maybe there are some bugs, ....

But it’s work for me !!!
Try it and send me some feedback,

Kaswy

 Signature 

My Setup :http://kaswy.free.fr

Profile
 
 
Posted: 23 January 2009 05:40 PM   [ Ignore ]   [ # 10 ]
Rank
Joined  2008-12-31
Total Posts:  37
New Member

I finally got the 2.6.29 kernel running right on Ubuntu, and the built-in driver does work. The random freezing isn’t as bad, but I still get it for some reason.

Going to try Kaswy’s new gspca and see if that helps any. The selectable frame rate should help a lot, that will probably explain the problems with it. Btw, thanks for the link to my tutorial (still got to get this on the wiki). wink

[edit] I created a wiki page for this. It is a bit rough, but it does explain the necessary information. I am also trying Kaswy’s gspca module. It works fine with 320x240x60, but I still get the occasional freezing on higher framerates or resolution. I can’t figure this out, unless it is a problem with the kernel USB interface (my motherboard should definitely be up to the task..). The little test program prints the FPS, then when it freezes it says ‘select timeout’, if that means anything to anyone.

Profile
 
 
Posted: 23 January 2009 05:54 PM   [ Ignore ]   [ # 11 ]
RankRank
Joined  2008-12-10
Total Posts:  209
Member

Spectactular kaswy!

I probably won’t get a chance to check it out ‘till tomorrow, great to see this moving forward!

 Signature 

22” LLP-LCD ftw
TUIO Smoke (Windows / Linux) - http://projects.edencomputing.com/projects/tuiosmoke

Profile
 
 
Posted: 25 January 2009 02:26 PM   [ Ignore ]   [ # 12 ]
Rank
Joined  2007-06-04
Total Posts:  31
New Member

I am a C coder in Linux platform and developing video application. Anything I could help? Anyway, I will try to get a PS3 Eye to have a look first. Thanks for the instruction.

Profile
 
 
Posted: 01 February 2009 02:50 PM   [ Ignore ]   [ # 13 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

Nice kaswy!  You beat me to itsmile

I won’t get home to my PS3Eye until later tonight, but I can’t wait to try this out!

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 02 February 2009 03:55 AM   [ Ignore ]   [ # 14 ]
Avatar
Rank
Joined  2008-12-02
Total Posts:  31
New Member

I hope that it will help people that want to use this good PS3 eye cam with Linux. If needed i think that we could add some controls like brightness,
contrast...an even other framerate (maybe needed for some users with some other screen refresh rate).
I use this driver in the 320x240@120 mode and it works fine for me, tell me if it does for you.

NUI community helped me a lot when i have started with MT, now if i can help a little, it’s with pleasure !

Thanks

 Signature 

My Setup :http://kaswy.free.fr

Profile
 
 
Posted: 10 February 2009 04:20 PM   [ Ignore ]   [ # 15 ]
Avatar
RankRankRankRankRankRank
Joined  2007-04-08
Total Posts:  2539
Dedicated

I can’t get this fully working with vw_kubel version or kaswy.

I have a built in web camera on my laptop. Using kaswy’s method, when I got to test with the webcam application, it loads my built in camera.

On vw_kuble’s method, when I got to vlc I can get audio from the ps3 mic to play, but I can’t see any video. You said to set the device to v4l2, but I don’t see an option of where to put that in VLC. I also don’t have “media” in VLC. (Open VLC, then go to Media > Open Capture Device). I do have File -> Open Capture device. I don’t know where to change it to v4l though.

Also kaswy, you say it’ll run at 640x480@100, but we know it can’t do that resolution at that fps. Is that a typo?

Any help would be appreciated.

 Signature 

MTmini, MTbiggie, & Audiotouch creator & Community Core Vision Co-founder

Follow on:
My Blog | Facebook | Twitter | Youtube

Profile
 
 
   
1 of 9
1
 
‹‹ Why 5?      Binoculars idea for camera ››