Wednesday 5 February 2014

INSTALL OPENCV

Hi Friends

Lets Install Opencv-2.4.6.1 as it has resolved bugs and stable


Step 1:-

Open a new document and paste the following in it

********************TEXT STARTS HERE*****************
arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else
flag=0
fi
echo "Installing OpenCV 2.4.6.1"
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -y remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -y install libopencv-dev
sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get -y install python-dev python-numpy
sudo apt-get -y install libtbb-dev
sudo apt-get -y install libqt4-dev libgtk2.0-dev
sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
sudo apt-get -y install x264 v4l-utils ffmpeg
echo "Downloading OpenCV 2.4.6.1"
wget -O OpenCV-2.4.6.1.tar.gz http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.6.1/opencv-2.4.6.1.tar.gz/download
echo "Installing OpenCV 2.4.6.1"
tar -xvf OpenCV-2.4.6.1.tar.gz
cd opencv-2.4.6.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j4
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV 2.4.6.1 ready to be used"
*******************TEXT ENDS HERE**************************

b)save the file as opencv.sh on the desktop


Step2:-
Open a terminal and type
a)cd Desktop
b)chmod +x opencv.sh
c)./opencv.sh

wait till u get the message " OpenCV 2.4.6.1 ready to be used "
####################CHEERS###########################

10-STEP PROCESS TO INSTALL PLAYER/STAGE/GAZEBO IN UBUNTU

Hi Friends

Lets get into installing player project in the ubuntu system in a very easy process of 10 steps.

Note:Please make sure the system has no version of opencv installed,if present make sure to remove it completely from the system libraries.You can install it after this process is complete.Also for  Ubuntu 12.10,13.04 or 13.10 the process remains same,but the library names/versions of dependencies we are going to install may differ.

Let's get started:-

Step 1:-

Create a directory named src in /home directory

In the terminal,type the following
a)mkdir src
b)cd src

Step 2:-

Download player and stage tar files and store in src
LINKS:
http://sourceforge.net/projects/playerstage/files/Player/3.0.2/player-3.0.2.tar.gz/download
http://sourceforge.net/projects/playerstage/files/Stage/3.2.2/Stage-3.2.2-Source.tar.gz/download

Step 3:-

Install pre-requisites/dependencies

in the terminal,type the following

a)sudo apt-get update
b)sudo apt-get upgrade
c)sudo apt-get install autotools-dev
d)sudo apt-get install build-essential
e)sudo apt-get install cmake
f)sudo apt-get install cpp
g)sudo apt-get install libboost-signals1.46.1
h)sudo apt-get install libboost-signals1.46-dev
i)sudo apt-get install libboost-thread1.46.1
j)sudo apt-get install libboost-thread1.46-dev
k)sudo apt-get install libcv2.3
l)sudo apt-get install libcv-dev
m)sudo apt-get install libgdk-pixbuf2.0-0
n)sudo apt-get install libgdk-pixbuf2.0-dev
o)sudo apt-get install libgnomecanvas2-0
p)sudo apt-get install libgnomecanvas2-dev
q)sudo apt-get install libgsl0-dev
r)sudo apt-get install libgtk2.0-dev
s)sudo apt-get install libjpeg62-dev
t)sudo apt-get install libtool
u)sudo apt-get install libxmu-dev swig
v)sudo apt-get install python2.7-dev
w)sudo apt-get install libcv-dev
x)sudo apt-get install libcvaux-dev
y)sudo apt-get install libhighgui-dev
z)sudo apt-get install freeglut3

a)sudo apt-get install freeglut3-dev
b)sudo apt-get install libfltk1.1
c)sudo apt-get install libfltk1.1-dev
d)sudo apt-get install libltdl7
e)sudo apt-get install libltdl-dev
f)sudo apt-get install libpng12-dev
g)sudo apt-get install libpng12-0

a)sudo apt-get update
b)sudo apt-get upgrade

Step 4:-

Install player-

In the terminal,type the following
a)tar xzvf player-3.0.2.tar.gz
b)cd player-3.0.2
c)mkdir build
d)cd build
e)cmake ../
f)sudo make

*****************************************************************************

NOTE:-Error bugs for make(if errors dont appear in 'make',please skip this part)

--error bugs while installation(if no errors skip this part)
1)cmake stopped with errors in timer.cpp
:- add #include <unistd.h> in timer.cpp

2)artoolkitplus error
:- install artoolkitplus
--$ cd Downloads
$ wget https://launchpad.net/artoolkitplus/trunk/2.3.0/+download/ARToolKitPlus-2.3.0.tar.bz2
$ tar xvjf ARToolKitPlus-2.3.0.tar.bz2
$ cd ARToolKitPlus-2.3.0
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

3)cmake stopped with readlog.cc error
:-make changes in readlog.cc
change line 668  -->  ret = gzseek(this->file,0,SEEK_SET);
TO -->                ret = gzseek((gzFile)this->file,0,SEEK_SET);
change line 714  -->  ret = (gzgets(this->file, this->line, this->line_size) == NULL);
TO -->                ret = (gzgets((gzFile)this->file, this->line, this->line_size) == NULL);

4)assembler message error
:- do "sudo make" instead of "make"

5)link cxx error-(cannot find opencv and other bullshits)(STILL A PROBLEM)
--
a)changes in .bashrc file of build
$cd
$gksudo gedit ./bashrc
add the following to it
$ export PATH=~/usr/local/bin:$PATH
$ export CPATH=~/usr/local/include:$CPATH
$ export LD_LIBRARY_PATH=~/usr/lib:$LD_LIBRARY_PATH

b)change the CMAKE_CXX_FLAGS variable in /player-3.0.2/build/CMakeCache.txt.
Change the line
CMAKE_CXX_FLAGS:STRING=
To
CMAKE_CXX_FLAGS:STRING=   -lboost_system
c)install all libdc files
d)install libpq-dev libpqxx-dev

****************************END OF ERROR BUGS*******************

g)sudo make

h)sudo make install

i)sudo updatedb

Step 5:-

Open a new terminal and type

a)gksudo gedit ./bashrc

When the file opens,add the following to the end of it

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/libplayercore
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/libplayerinterface
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/libplayercommon
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/client_libs/libplayerc++
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/USER/src/player-3.0.2/build/client_libs/libplayerc
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH
export PATH=$PATH:"/usr/local/lib64"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/local/lib":"/usr/local/lib64"
export PLAYERPATH="/usr/local/lib":"/usr/local/lib64"
export STAGEPATH="/usr/local/lib":"/usr/local/lib64"

Step 6:-

Checking installation

in the treminal : $ pkg-config --libs playercore
(output: -L/usr/local/lib64 -lplayercore -lpthread -lltdl -ldl -lplayerinterface -lplayercommon)
In the terminal : $ pkg-config --cflags playercore
(output: -I/usr/local/include/player-3.0)

Step 7:-

Install Stage

In the terminal,type the following

a)sudo apt-get update
b)sudo apt-get upgrade
c)tar xzvf Stage-3.2.2-Source.tar.gz
d)cd Stage-3.2.2-Source/
e)mkdir build
f)cd build/
g)cmake ../
h)sudo make

*****************************************************************************************

NOTE:-Error bugs for make(if errors dont appear in 'make',please skip this part)

--error bugs while installation(if no errors skip this part)

--error with undefined reference to various libs and functions

In the same terminal,type
a)cd ..
c)sudo gedit CMakeLists.txt

Note:-This CMakeListestxt file will be in the folder Stage-3.2.2-Source,make sure to do the changes in the correct one if you open a new terminal
change the three lines:
SET (CMAKE_CXX_FLAGS_RELEASE " -O3 -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags for release" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG " -ggdb ${WALL} " CACHE INTERNAL "C Flags for debug" FORCE)
SET (CMAKE_CXX_FLAGS_PROFILE " -O3 -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)

TO:

SET (CMAKE_CXX_FLAGS_RELEASE " -O3 -DNDEBUG -Wl,--no-as-needed" CACHE INTERNAL "C Flags for release" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG " -ggdb -Wl,--no-as-needed " CACHE INTERNAL "C Flags for debug" FORCE)
SET (CMAKE_CXX_FLAGS_PROFILE " -O3 -ggdb -pg -Wl,--no-as-needed " CACHE INTERNAL "C Flags for profile" FORCE)

(save and close the file)

********************* END OF ERROR BUGS*******************************

i)cd build

j)sudo make

k)sudo make install

Step 8:-

Testing installation
open a new terminal
a)cd src/Stage-3.2.2-Source/worlds
b)player simple.cfg

Step 9:-

Installing gazebo(1.9.1)
open a new terminal

a)sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
b)wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
c)sudo apt-get update
d)sudo apt-get install gazebo

Step 10 :-

Testing gazebo
open a new terminal

a)gazebo
(for the first run it takes time to open the gui,keep patience)

NOTE:-to add models manually to gazebo
open a terminal and type
a)cd ~/.gazebo/models
b)wget -R *index.html*,*.tar.gz --cut-dirs=1 --no-parent -r -x -nH http://gazebosim.org/models/HERE YOU ENTER THE MODEL NAME/

You have now succeeded in installing player/stage/gazebo.

For any further queries please let me know in the blog or mail me at "abhishek4273@gmail.com".

############CHEERS############3