Thứ Bảy, 15 tháng 6, 2013

Question: Where does my program reside if I install a program in Ubuntu?

Answer:
Normally, it would go to /usr/local. In /usr/local, you would have subdirectories such as /bin, /etc, /lib, /share, /src. These sub-folders contain appropriate files depending on the type of program that you want to install.

Thứ Sáu, 14 tháng 6, 2013

HOW-TO: Install OpenCV-2.4.5 and ffmpeg-1.2.1 in Ubuntu 64bits

Bug       
      After spending several days to install the latest ffmpeg with the latest OpenCV, I discovered that I made a stupid mistakes. The follow is a big-bug that I had met during installing ffmpeg-1.2.1 which create shared library in order for OpenCV to recognize it.
'libavutil/intfloat_readwrite.o: relocation R_X86_64_PC32 against undefined symbol `ldexp@@GLIBC_2.2.5'. 
This error because of bad symbolic link in ubuntu. The reason is that I placed my install folder in shared folder between my computer and Virtualbox VMs [4]. Anyway, if you meet this error, please moving your folder to a safer place, not a shared folder. On the other hand, installing ffmpeg and opencv require you to to have --enable-shared option which create shared-library. So, you need to do the same to all other dependencies, --enable-shared option as in [3]. Other possible remedy, you might want to run ldconfig command to update run-time linker default [5]. The exact structure for this command is
ldconfig [your ffmpeg installer folder].
Installation         
      I am writing this post to summerize steps to install ffmpeg a common media cross-platform for OpenCV-2.4.5 to localize it. I recommend you to follow the instructions in  [3]. You can also follow [1] and
[2]. Refering to [2], you can test if you install OpenCV correctly (testing section). I copy and paste here for easy to refer.
Testing
An easy way to test that the compilation went well is to use the OpenCV test utilities. For example, to test the core module go to OpenCV-2.4.5/build/bin and run:
./opencv_test_core
 You should see something like this:

Note that some failures when testing other modules may come from missing image files. To correctly run these tests or samples you should move the corresponding image files from OpenCV-2.4.5/samples to OpenCV-2.4.5/build/bin.

For testing that you can compile your own programs and link against the installed OpenCV libraries I have packaged the face detection sample with all the necessary files and a simple Makefile. Download it here, extract and type:
make
This should compile and run with a test image, so you should see something like this: