CCV + PS3 EYE

STEP 1: Get Ubuntu.

The first step is to get the most current copy of Ubuntu. The reason I have chosen Ubuntu is because it is very user friendly and now days one of the most supported distro's out there.

We will be working with version 10.04.

You can get the latest version here:

http://www.ubuntu.com/desktop/get-ubuntu/download


An important note: Get the 32 bit version. I have not yet attempted this with 64 bits. That will come in the future.

Once you have the .iso file downloaded, burn it to a disk. If you don't know how to do this, follow step 2 on :

http://www.ubuntu.com/desktop/get-ubuntu/download

-----

For those of you like myself who prefer to download large files as a torrent, you can get the torrent here:

http://releases.ubuntu.com/10.04.1/ubuntu-10.04.1-desktop-i386.iso.torrent


-----

Now I am assuming that since you are interested in developing MT Apps and Systems for Linux, you have some kind of Linux background. This is the only thing I am going to assume through out this blog. If you can't get a fresh install of Ubuntu 10.04 on your system than there is no hope for you. Also, I am not responsible for any data loss or damages when you try to install a fresh copy of Ubuntu on your computer.


STEP 2: Install Ubuntu and Start Up.

So now that you have your Ubuntu cd, throw it in your disk drive and install it. Be careful though! If you are going to install this on a computer that already has another operating system on it you can easily erase EVERYTHING including the operating system itself.

Follow the instructions on the screen. I decided to create a user name of mt-dev for this instillation.

The computer will restart when the instillation is complete. Go ahead and log in. Connect yourself to the internet.

NOTE: This is the most important step in everything we are going to do: The very first time you log in, do not install any new programs, do not install any updates if the package manager asks you to. DO NOT INSTALL ANYTHING, unless it is in this blog, in the right order.

STEP 3: Getting VLC.

The next thing we need to do before anything else is get VLC. Vlc is a very versatile media player.

Click on Applications --> Accessories --> Terminal

now enter the following command:
  • sudo apt-get install vlc

STEP 4: Getting the ps3 eye to work!

The following is based off the tutorial from kaswy's page.

I have however made a couple small changes that are required. Open up your terminal and enter the following commands.
  • sudo -i
  • apt-get install kernel-package libncurses5-dev wget bzip2 build-essential
  • cd /usr/src
  • apt-get install linux-source
Now type in:

  • ls
You will now get a list of everything in the directory. Look for the .tar.bz2 file.
<your version> is the number that is between the 2.6. and the .tar.bz2. in my case the file is: linux-source-2.6.32.tar.bz2 so my <your version> is 32

Now type in the following command, but replace the <your version> with the proper number.
  • tar --bzip2 -xvf linux-source-2.6.<your version>.tar.bz2
  • ln -s linux-source-2.6.<your version> linux
  • cd linux
In my case it would look like this:
  • tar --bzip2 -xvf linux-source-2.6.32.tar.bz2
  • ln -s linux-source-2.6.32 linux
  • cd linux
Continue with these commands:
  • wget http://kaswy.free.fr/sites/default/files/download/ps3eye/0.5/ps3eyeMT-2.6.31-10-generic.patch
  • patch -p1 < ps3eyeMT-2.6.31-10-generic.patch
  • make oldconfig
  • cp /usr/src/linux-headers-$(uname -r)/Module.symvers /usr/src/linux
  • make modules_prepare
  • make SUBDIRS=drivers/media/video/gspca modules
  • cp drivers/media/video/gspca/gspca_ov534.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca/
  • depmod
  • modinfo gspca-ov534
You should see the following after entering the last command:

root@mt-dev-laptop:/usr/src/linux# modinfo gspca-ov534
filename: /lib/modules/2.6.32-24-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko
license: GPL
description: GSPCA/OV534 USB Camera Driver(kaswy mod for MT use V0.5)
author: Antonio Ospite
srcversion: 2153E3BE52298A39177E46C
alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
depends: gspca_main
vermagic: 2.6.32.15+drm33.5 SMP mod_unload modversions 586
parm: videomode: = xx //Set the videomode(see doc) (int)
parm: autogain: = [0|1] //Autogain (agc,aec,awb) (bool)
parm: gain: = [0..63] //main gain (int)
parm: exposure: = [0..255] //Exposure (int)
parm: redblc: = [0..255] //Red Balance (int)
parm: blueblc: = [0..255] //Blue Balance (int)
parm: sharpness: = [0..63] //Sharpness (int)
parm: vflip: = [0|1] //Vertical flip (bool)
parm: hflip: = [0|1] //Horizontal mirror (bool)
root@mt-dev-laptop:/usr/src/linux#

The important part is the description where it has v0.5 and kaswy's name.

Go ahead and enter the following commands:

  • modprobe -r gspca-ov534
  • modprobe gspca-ov534 videomode=01 autogain=0 exposure=200 hflip=1
Now exit back to the normal account by typing: exit

This completes the first step to getting the ps3eye working properly.
On to modifying and installing unicap

Enter the following commands:

  • cd
  • mkdir unicap
  • cd unicap
  • wget http://unicap-imaging.org/downloads/unicap-0.9.5.tar.gz
  • tar -xvzf unicap-0.9.5.tar.gz
  • wget http://kaswy.free.fr/sites/default/files/download/ps3eye/unicap/unicap-gspca.patch
  • patch -p0 < unicap-gspca.patch
  • cd unicap-0.9.5
  • ./configure
  • make
  • sudo make install
Unicap should now be working.

STEP 5: Testing the ps3 eye with VLC.

It is time to test out our ps3 eye!

First off I want to say that I am using a wonderfully modified ps3 eye made by Nolan at Peau Productions. I have a 780nm band pass filter, which is why my vlc stream will appear a very dark orangish / red.

Click on Applications --> Sound & Video --> VLC Media Player

You should see the following:


Now on VLC, click on Media --> Open Capture Device

If your computer, like my laptop has a built in video camera, your ps3 eye will not be /dev/video0 it will be /dev/video1 assuming your ps3 eye is the only other webcam you have hooked up to your computer.

Under the video device name put in your ps3 eye. In my case it looks like this since my laptop has a built in webcam:


Press play and see your ps3 eye working!



STEP 6: Compiling CCV on Ubuntu 10.04



Now we are going to compile CCV for Ubuntu 10.04.

Make sure you DO NOT start here. You need to start at the beginning of the blog and follow from there, if you try to do this tutorial BEFORE this one, your ps3 eye will NOT work with CCV.

The following is a modified tutorial based off of x29a's post on the nui group forums.

Enter the following commands:
  • sudo apt-get install subversion
  • sudo su
  • cd /opt
  • svn co http://nuicode.svnrepository.com/svn/tbeta/trunk/tbeta/Linux/ ccv-Linux
  • cd /opt/ccv-Linux/scripts/ubuntu
  • chmod +x *.sh
  • ./install_codeblocks.sh
  • ./install_dependencies.sh
  • apt-get install libpoco-dev
  • apt-get install gpp
  • cd /opt/ccv-Linux/
  • cd apps/addonsExamples/Codeblocks_8_linux/
Now Download the following zip file. It contains the files I modified so that it will build on ubuntu 10.04: http://mt-dev.googlecode.com/files/codeblocks.tar

Unzip it to your Documents folder.

Back in your terminal enter the following command:
  • nautilus
Navigate to /opt/ccv-Linux/apps/addonsExamples/Codeblocks_8_linux
and delete the following files:
  1. Community Core Vision.cbp
  2. Community Core Vision.depend
  3. Community Core Vision.layout
  4. Makefile
Now navigate to where you unziped my file. Select and cut the 4 files and paste them in the /opt/ccv-Linux/apps/addonsExamples/Codeblocks_8_linux folder.

Close Nautilus. Back in the terminal enter the following commands:

  • cd /opt/ccv-Linux/libs/fmodex/lib
  • rm libfmodexp.so libfmodex.so
  • ln -s libfmodex-4.22.00.so libfmodex.so
  • ln -s libfmodexp-4.22.00.so libfmodexp.so
  • cd /opt/ccv-Linux/apps/addonsExamples/Codeblocks_8_linux/bin/libs
  • rm libfmodexp.so libfmodex.so
  • ln -s libfmodex-4.22.00.so libfmodex.so
  • ln -s libfmodexp-4.22.00.so libfmodexp.so
  • cd /opt/ccv-Linux/
  • codeblocks apps/addonsExamples/Codeblocks_8_linux/Community\ Core\ Vision.cbp
Now in codeblocks click Build --> Build.
You may get some errors, just click OK and ignore them.
CCV should now have successfully built. Close Codeblocks and go back to your terminal and enter the following commands:

  • cd /opt/ccv-Linux/apps/addonsExamples/Codeblocks_8_linux/bin
  • gedit start.sh
In gedit copy and paste the following:

#!/bin/sh
echo $(pwd)
export LD_LIBRARY_PATH=$(pwd)/libs/
./
Community_Core_Vision

Click File --> Save. Now close gedit. Now enter the following commands into your terminal:

  • chmod +x start.sh
  • cd data
  • gedit config.xml
In the Camera settings change UseCamera to 1. Click File --> Save. Close gedit.

To Start CCV enter the following commands in your terminal:


  • cd /opt/ccv-Linux/apps/addonsExamples/Codeblocks_8_linux/bin
  • ./start.sh
Congrats! You are now running CCV with the ps3 eye! if the camera feed is not from your ps3 eye but from another camera on your computer don't fear! Go back to the terminal in which your ran /start.sh and scroll up till you see the list of video capture devices, take note of which device your ps3 eye is and change the device number in config.xml to that and restart CCV with start.sh! Thats it! Hope this helps all those out there who want to develop MT on linux with CCV and a ps3 eye. Please comment if my instructions don't work anywhere in this blog.