For Linux :
1] Install CMake and some prerequisite libraries.
(You can skip this if you just use the pre-built Visual Studio 2008/2010 binaries for Windows).
2] Untar the tarball downloaded, say OpenCV-x.y.z.tar.bz2 using the command as follows
$ tar -xvf OpenCV-x.y.z.tar.bz2
3] Enter the new directory created for OpenCV in your current directory as follows
$ cd OpenCV-x.y.z
4] Make a new directory here, say GUI
$ mkdir GUI
5] Enter the newly created directory GUI
$ cd GUI
6] Run the following command
$ cmake ../.
If this command fails, check if you have "cmake" installed.
7] After the successful execution of above command run following command
$ make
8] Again if above command runs successful, run the following command as "ROOT"
# make install
9] Successful completion of above command is followed by following commands:
# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# export PKG_CONFIG_PATH
Note: If using Fedora, Kindly add the commands mentioned in "step 9" to file named ".bash_profile" in the home folder through shell and reboot the system.
10] Last Step
#ldconfig
10] Last Step
#ldconfig