A. set proxy
1. System -> Preferences -> Network Proxy
2. Check "Automatic proxy configuration"
3. URL = http://proxy.cse.cuhk.edu.hk/proxy/cse.pac
4. Click the Apply System-Wide button
5. Should see some pop-up windows requesting password
6. Enter your password.
7. Close

B. Update Ubuntu
1. System -> Administration -> Synaptic Package Manager
2. Enter Password if needed
3. Setting -> Repositories
4. Under "Ubuntu Software" tab, change "Download from" to "Main Server"
5. Under "Updates" tab, change "Release upgrade" to "Never"
6. Close the Repositories window
7. Click the "Reload" button at the top left corner.
8. Click the "Mark All Upgrades" button.
9. You may see a pop-up window showing the packages to be upgraded. Click "Mark"
10. Click the "Apply" button.
11. Click "Apply" in the pop-up window.
12. Since it is the first update, it may take a very long time to complete. (Depends on the traffic and number of updates, it may take around 30 minutes to complete.)
13. The upgrade may require reboot(e.g. update Kernel requires reboot). save you file and reboot.

***** NOTE *****
If you prefer using command line for step 7 to 12, here is the commands:
sudo apt-get update
sudo apt-get upgrade

C. Install package
Since some development packages are missing, we have to download them.
The packages are:
1. build-essential
2. cmake-qt-gui
3. doxygen

As we know the name of the package, we can use some command lines to install them very fast.
The command is :
sudo apt-get install build-essential cmake-qt-gui doxygen

After entering the password, the system will start download the packages and install them.
In fact, the system will not only install the specified packages but also their dependencies.
You don't have to worry about the dependency hell problem. The system will handle them for you.

By default, the system will look for update daily. The upgrades are safe because they are tested by
the ubuntu maintainers before release. Therefore, it is good to check and install the update daily.

***** Note *****
When you build OpenCV and other projects from source, you have to resolve the
dependency problem yourself. For example, libpng-dev is required by OpenCV.
You can search and install the package in Synaptic Package Manager.

D. Install OpenCV
1. Download the source tar ball from sourceforge and save it to your download directory (e.g. ~/Downloads)
2. Open a terminal:
Applications -> Accessories -> Terminal
3. Go to the download directory by typing this command:
cd Downloads
4. unzip the tar ball
tar xfv OpenCV-2.2.0.tar.bz2
5. Go to the OpenCV source code directory
cd OpenCV-2.2.0
6. Run CMake-gui
cmake-gui .
7. Change the "binaries" directory to /home/your_name_here/Downloads/OpenCV-2.2.0/build/unix_27_june_2011
8. Click the "configure" button
9. If cmake prompts you about making the directory, please click "OK"
10. To specify the generator, choose "Unix Makefiles" and "Use default native compilers"
11. After a few seconds, a list will be shown and most of the entries are in red. It is because
some of the packages are missing. we need to install them otherwise, we cannot compile the
OpenCV library.

Here are the steps:
i) check the "Grouped" and "Advanced" box in CMake.
ii) Expand the tab called "JASPER" by click the small triangle next to it.
iii) Since we haven't install the JASPER library, CMake will show:
iv) Start the synaptic Package Manager
v) Search "libjasper" in the Quick Search box.
vi) A package called "libjasper-dev" will be shown in the results.
Right click the entry and choose "Mark for installation"
vii) Click the "Apply" button and wait until the installation complete.
viii) Go back to CMake and click the Configure button again. You should see
JASPER_LIBRARY /usr/lib/libjasper.so

You should repeat the steps from (i) to (viii) for other libraries:
JPEG: libjpeg62-dev
OPENEXR: libopenexr-dev
PNG: libpng12-dev
TIFF: libtiff4-dev
ZLIB: zlib1g-dev
GTK2: libgtk2.0-dev
avcodev: libavcodec-dev
v4l: libv4l-dev
gstreamer: libgstreamer0.10-dev
python: python2.6-dev
numpy: python-numpy
scipy: python-scipy

***** NOTE *****
you can use this command to install all of the dependencies:
sudo apt-get install libjasper-dev libjpeg62-dev libopenexr-dev libpng12-dev libtiff4-dev zlib1g-dev libgtk2.0-dev libavcodec-dev libv4l-dev libgstreamer0.10-dev
As the time goes by, the version number of the libraries may change. Please search them on Synaptic Package Manager.

12. After all the dependencies are resovled, you can click the "Configure" button and then "Generate" button.
13. Change the working directory of the terminal to where the binaries are built.
cd /home/your_name_here/Downloads/OpenCV-2.2.0/build/unix_27_june_2011
14. Compile the library: type the following in the terminal
15. Install the library: Type the following in the terminal
sudo make install
16. Update the library database:
sudo ldconfig
17. Update PYTHONPATH:
open the bashrc file:
gedit ~/.bashrc
at the end of the file, add this line:
export PYTHONPATH=/usr/local/lib/python2.6/site-packages/:$PYTHONPATH
save and exit
run this command:
source ~/.bashrc
18. Test OpenCV:
go to the bin folder where you build the opencv:
cd /home/your_name_here/Downloads/OpenCV-2.2.0/build/unix_27_june_2011/bin
run the "delaunay" example
if you have a camera connected, you can run the lkdemo or camshift

go to the samples code from the source code folder:
cd /home/your_name_here/Downloads/OpenCV-2.2.0/samples/python
run the python
python delaunay.py

E. Eclipse
1. install it from Synaptic Package Manager
2. install the CDT from http://www.eclipse.org/cdt/
3. To config a eclipse C/C++ project to use OpenCV
i) Open the properties window of the project
ii) Go to C/C++ build -> Settings -> GCC C++ Compiler -> Directories
iii) Add "/usr/local/include/opencv" and "/usr/local/include/opencv2"
iv) Go to GCC C++ linker -> Libraries
v) Add these to Libraries(-l):
4. Now your project is ready for OpenCV development

1. install PyDev, follow http://catyku.pixnet.net/blog/post/24193322

BUT do the following change:

再來在Help->SoftWare Updates -> Available Software - > 按Add Site

-----DONT USE THIS----> http://pydev.sourceforge.net/updates/
-------USE THIS-------> http://pydev.org/updates/

2. Add the cv library into your PyDev project:
project -> Properties -> PyDev - PYTHONPATH -> external Libraries -> Add source folder