Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Installing OpenCV (http://www.chiefdelphi.com/forums/showthread.php?t=122522)

yash101 29-11-2013 22:52

Installing OpenCV
 
I have been having quite some trouble in getting OpenCV installed. After doing a quick search, "installing opencv," I got no good results. I have tried many of the installation techniques listed in various websites, found by searching, installing opencv. <<Hopefully, no one finds that offensive :(. Does anyone have a link to some good documentation on how to quickly install OpenCV? I am interested in compiling it, because I can use Git and get the latest code!

ad1217 29-11-2013 23:13

Re: Installing OpenCV
 
Question that will definitely help troubleshoot: What OS are you running?

yash101 29-11-2013 23:28

Re: Installing OpenCV
 
Currently Debian, however, I will switch to Ubuntu whenever possible. Ubuntu is basically Debian, with tons of add-ons!

billbo911 29-11-2013 23:58

Re: Installing OpenCV
 
Quote:

Originally Posted by yash101 (Post 1307176)
I have been having quite some trouble in getting OpenCV installed. After doing a quick search, "installing opencv," I got no good results. I have tried many of the installation techniques listed in various websites, found by searching, installing opencv. <<Hopefully, no one finds that offensive :(. Does anyone have a link to some good documentation on how to quickly install OpenCV? I am interested in compiling it, because I can use Git and get the latest code!

If you used the install directions in the link you provided, you undoubtedly made it to this page.

Was there an issue with following those steps? I know it is written for Linux, but I followed it for Ubuntu and was successful. I believe it "should" work as well for Debien, as long as you compensate for any minor differences.

yash101 30-11-2013 01:16

Re: Installing OpenCV
 
Yes. That is the first link that I clicked on. However, it does not include a comprehensive list of resources required by OpenCV. I want to have maximum compatibility, so I will make sure to get everything, even if I have to compile it myself! Also, that says,
cmake [<some optional parameters>] <path to the OpenCV source directory>

I do not know the optional parameters. I haven't messed around with CMAKE that much, so I do not know how to get the list of parameters.

Right now, I am following a tutorial on ozbots:
http://www.ozbotz.org/opencv-installation-2-3-1/http://www.ozbotz.org/opencv-installation-2-3-1/

Since that is for OpenCV 2.3.1, could that cause any faults?

Thanks!

otherguy 30-11-2013 11:30

Re: Installing OpenCV
 
This page, with instructions for opencv installation on debian, explains the cmake "optional parameters" a bit more.

hzheng_449 30-11-2013 12:03

Re: Installing OpenCV
 
Also in Ubuntu 12.04 (which by the way is the LTS, so if you're gonna switch switch to 12.04) you can just apt-get the libraries (and of course it will also list out and allow you to install all the dependencies). This is what ended up doing since it's the easiest option...

link to apt-get installing opencv (the package may be slightly out of date)

On a slight tangent, I'm not really a fan of cmake, and if you aren't either, it's worth the time to google how to compile openCV projects with g++.

yash101 30-11-2013 12:56

Re: Installing OpenCV
 
That helps quite a bit. That article describes a little more on how to configure CMAKE. Right now, I am stuck on installing FFMPEG, because Apt won't download the current version of YASM (I have already run apt-get update). Currently, I am performing a distribution upgrade of Ubuntu, because I am running 12.04. Hopefully that will help! What webcam do you guys suggest for powerful vision tracking? I was thinking of a camera with a high shutter speed, low ISO, and high aperture. That would allow me to set up a spotlight of light, to be retroreflected to the camera. The camera would only be able to capture that bright light!

Quote:

Originally Posted by hzheng_449 (Post 1307257)
Also in Ubuntu 12.04 (which by the way is the LTS, so if you're gonna switch switch to 12.04) you can just apt-get the libraries (and of course it will also list out and allow you to install all the dependencies). This is what ended up doing since it's the easiest option...

link to apt-get installing opencv (the package may be slightly out of date)

On a slight tangent, I'm not really a fan of cmake, and if you aren't either, it's worth the time to google how to compile openCV projects with g++.

I agree. I am not a fan of CMAKE either. I was just going to use an IDE like Netbeans! That would get rid of all the confusion, caused by setting up! I will google about how to compile OpenCV projects using g++. I believe it uses PKG-CONFIG, so it shouldn't be rocket science!




PHP Code:

While compiling OpenCVat 20%, I got this error:
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/rgbe.cpp.o
Linking CXX shared library 
../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.3.0.0] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2 

Does anyone know what it could be?

brennonbrimhall 30-11-2013 21:51

Re: Installing OpenCV
 
Quote:

Originally Posted by yash101 (Post 1307262)
I agree. I am not a fan of CMAKE either. I was just going to use an IDE like Netbeans! That would get rid of all the confusion, caused by setting up! I will google about how to compile OpenCV projects using g++. I believe it uses PKG-CONFIG, so it shouldn't be rocket science!

While no build system is perfect, CMake does a good job of managing cross-platform building. I wouldn't dismiss it too readily. But we digress.

Quote:

Originally Posted by yash101 (Post 1307262)
PHP Code:

While compiling OpenCVat 20%, I got this error:
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/rgbe.cpp.o
Linking CXX shared library 
../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.3.0.0] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2 

Does anyone know what it could be?

Based on what I'm reading here, I'm inclined to think that OpenCV is having issues on the AV codec for it's internal HighGUI library.

Are you using parallel builds with make? That might explain it -- this step could be dependent on another step that has not been completed yet.

hzheng_449 30-11-2013 23:39

Re: Installing OpenCV
 
Quote:

Originally Posted by yash101 (Post 1307262)

PHP Code:

While compiling OpenCVat 20%, I got this error:
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/rgbe.cpp.o
Linking CXX shared library 
../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.3.0.0] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2 

Does anyone know what it could be?

I'm pretty sure I got a similar build error when I was installing openCV(which was around September). Hopefully Brennon's suggestion works, if not try building an older version of openCV or do the "lazy" thing and apt-get the library (which is what I ended up doing).

faust1706 01-12-2013 00:16

Re: Installing OpenCV
 
Since you said you were going to switch to ubuntu...here is the "master list" a mentor and I came up with 2 years ago:

sudo apt-get install synaptic

sudo apt-get update

*sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

*sudo apt-get install qtcreator

sudo su

sudo apt-get install build-essential

sudo apt-get install libavformat-dev

sudo apt-get install ffmpeg

sudo apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev

**apt-get install freenect

*install qt creator, an IDE (integrated development platform)
**for kinect

we used these exact steps for our O-Droid XUs we got 2 weeks ago and all are running vision programs without any problems.

yash101 01-12-2013 13:09

Re: Installing OpenCV
 
I did try to build many of the things like x264 and ffmpeg, and whatever I couldn't find in the apt repository, myself, from the git code! I think that I may be using too current of a code! That could be why I am having many of these problems!

I think it would be wise for someone (maybe me), to create an install script, to install every package from Apt, and then download source from git to build! ;)

brennonbrimhall 01-12-2013 13:21

Re: Installing OpenCV
 
Quote:

Originally Posted by yash101 (Post 1307448)
I did try to build many of the things like x264 and ffmpeg, and whatever I couldn't find in the apt repository, myself, from the git code! I think that I may be using too current of a code!

Might be a bit late, but this is the official documentation from OpenCV with regards to building on Linux. Unless you plan on working on OpenCV itself, I'd stick with version 2.4.7, which is the latest stable version.

EDIT: As of 11/11/13, the latest version of OpenCV is 2.4.7.

yash101 01-12-2013 13:26

Re: Installing OpenCV
 
2 Attachment(s)
It's not too late. I just need to redownload OpenCV and reconfigure it. Just a half hour, maybe. I have succeeded at building OpenCV from git before, but I do not know what is different this time. Let me make sure that I have properly installed LibAVCodec!

BTW, Brennon Brimhall, Thanks for the quick reply!



EDIT:
I just booted Ubuntu and checked the libavcodec installation status and found out that it wasn't properly installed. I forgot libavcodec-dev, but installed libavcodec-53! Now, let me retry the build, and hopefully I won't encounter any problems! :D


The build is still failing continuously. What do I do? I have uploaded a txt file with the output, created by make | tee dev_build.txt
I have tried re-installing libavcodec-dev libavcodec53 libavcodec-extra-53 but the problem persists. Should I compile it myself, or should I get a different mirror, update my system, or am I downloading a completely wrong package?


UPDATE:
I am compiling the code in the fashion that Brennon suggested, downloading the latest stable build from SourceForge. Currently it is compiling. I will include a build log, build_log.txt.

Thanks for your help

yash101 01-12-2013 18:05

Re: Installing OpenCV
 
It seems as though maybe the libavcodec package may be broken :(. That is what is stopping me from having a complete build!


All times are GMT -5. The time now is 03:06.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi