tsdconseil / opencv-demonstrator

OpenCV demonstrator (GUI)
http://www.tsdconseil.fr/log/opencv/demo/index-en.html
GNU Lesser General Public License v3.0
141 stars 57 forks source link

Building under Ubuntu 14.04.3 #6

Closed valera-rozuvan closed 8 years ago

valera-rozuvan commented 8 years ago

Hi @shervinemami and @juliena82 . Below are the instructions that I used to build this project under Ubuntu 14.04.3. Please verify them, when you get the chance.

$ cd ~/
$ sudo aptitude update
$ sudo aptitude upgrade
$ sudo aptitude install build-essential cmake git pkg-config libjpeg8-dev libtiff4-dev \
    libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
    libgtk2.0-dev libatlas-base-dev gfortran libgtkmm-3.0-1 libgtkmm-3.0-dev \
    libgtkmm-3.0-doc bison flex
$ mkdir build_from_source
$ cd build_from_source/
$ wget https://github.com/Itseez/opencv/archive/3.0.0.tar.gz
$ tar -zxvf 3.0.0.tar.gz
$ rm -rf 3.0.0.tar.gz
$ wget https://github.com/Itseez/opencv_contrib/archive/3.0.0.tar.gz
$ tar -zxvf 3.0.0.tar.gz
$ rm -rf 3.0.0.tar.gz
$ cd opencv-3.0.0
$ mkdir build
$ cd build/
$ cmake \
    -DCMAKE_BUILD_TYPE=RELEASE \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DINSTALL_C_EXAMPLES=ON  \
    -DOPENCV_EXTRA_MODULES_PATH=~/build_from_source/opencv_contrib-3.0.0/modules \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DWITH_GTK=ON \
    ..
$ make --jobs=4
$ sudo make install
$ sudo ldconfig
$ cd ~/build_from_source
$ git clone https://github.com/tsdconseil/opencv-demonstrator.git
$ cd opencv-demonstrator/libcutil
$ export TARGET=LINUX
$ make
$ cd ../ocvext
$ make
$ cd ../ocvdemo
$ make

Next, run the program with:

$ cd ~/build_from_source/opencv-demonstrator/ocvdemo
$ ./build/debug/ocvdemo.exe

If it works for you guys, we can put these instruction into our documentation on how to build this project under Ubuntu.

PS: If you don't have aptitude installed, use apt-get or install aptitude with the command

$ sudo apt-get install aptitude
shervinemami commented 8 years ago

Thanks! I'll try it on Linux Mint 17.1 KDE ...

valera-rozuvan commented 8 years ago

@shervinemami @juliena82 I forgot one very important build step! = ) You need to do:

$ export TARGET=LINUX

Before you start building this project. I will update the instructions, and include this step.

juliena82 commented 8 years ago

Very cool to have noted all the build steps, especially the list of Tools to be installed for opencv. Is the list of OpenCV CMAKE options complete in your listing (I mean are the three dots to be replaced by something) ?

valera-rozuvan commented 8 years ago

@juliena82 Please check again the build instructions! There are 2 dots! They represent the parent directory. Cmake needs the path to the source directory. When you are inside build directory, the source directory is exactly one level above you. That's why we use ...

Yes. The options for the cmake are complete. You don't need to add anything else to the options.

juliena82 commented 8 years ago

Perfect! Now we have very precise and repeatable build instructions for Linux. Maybe we can update the doc/build-instructions.md file with it?

valera-rozuvan commented 8 years ago

@juliena82 I would prefer that at least @shervinemami should verify them. They worked for me. Who knows if they will work only for me?

juliena82 commented 8 years ago

Yes good idea indeed! Also I can try to verify it myself, I have an old Ubuntu distribution (I must first repair a problem I have with apt-get update that seems to not work anymore...)

shervinemami commented 8 years ago

I'm halfway through building OpenCV, should be another 20 mins or so. This is a very minor issue, but I recommend getting rid of the "build_from_source" folder and just create the 3 folders into the home folder (or rename the "build_from_source" folder to "opencv-demonstrator").

juliena82 commented 8 years ago

renaming to "opencv-demonstrator", or "ocvdemo" would be a good choice I think too.

valera-rozuvan commented 8 years ago

@shervinemami It's just that some people prefer to build libraries and software packages in a specific directory. Some of by friends have a ~/bin/ folder for this. I saw someone just has a ~/projects directory. Anyways, obviously you can do it in your ~/ directory.

We can't rename the build_from_source folder to opencv-demonstrator because then we would have a opencv-demonstrator/opencv-demonstrator folder = )

valera-rozuvan commented 8 years ago

@juliena82 I would keep the GitHub project named opencv-demonstrator. This way - Google can find the opencv part in the name! For the executable built, we can of course name it as ocvdemo.

juliena82 commented 8 years ago

@valera-rozuvan Yes you are right. I didn't mean to rename the project ;)

shervinemami commented 8 years ago

@valera-rozuvan yes it's only a very minor issue so it's OK either way :-) Let's just leave it how it is now but in the instructions we can just say something like: These instructions will download & build OpenCV 3.0 and OpenCV-demonstrator into a "build_from_source" folder, but feel free to place it anywhere you wish.

valera-rozuvan commented 8 years ago

into a "build_from_source" folder, but feel free to place it anywhere you wish.

@shervinemami +1

shervinemami commented 8 years ago

I'm building the code now ...

shervinemami commented 8 years ago

It worked perfectly in Linux Mint 17.1 KDE! Well done!

valera-rozuvan commented 8 years ago

= ) OK. I will add these instructions to the file build-instructions.md.

valera-rozuvan commented 8 years ago

Issue fixed in commit 21beab753e35f4513d870bfad74e7afe7373836f.