Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 229 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
229
Dung lượng
12,17 MB
Nội dung
[...]... –-enable-libopencore-amrnb –-enable-libopencore-amrwb enable-libtheora enable-libvorbis enable-libx264 enable-libxvid enable-nonfree enable-postproc enable-version3 enable-x11grab –-enable-shared –-enable-pic 10 Chapter 2 ■ Setting up OpenCV On YOur COmputer Checking the Installation You can check the installation by putting the following code in a file called hello _opencv. cpp It displays an image, and... Install (64-bit) If you have the 64-bit version of Ubuntu, the process remains largely the same, except for the following changes 1 During the step 5 to configure x264, use this command instead: /configure enable-shared –-enable-pic 2 During the step 6 to configure ffmpeg, use this command instead: /configure enable-gpl enable-libfaac enable-libmp3lame –-enable-libopencore-amrnb –-enable-libopencore-amrwb... all the necessary OpenCV files in OPENCV_ DIR/build/install-files 4 Now, edit the file ~/.bashrc (your local bashrc file over which you should have read/write access) and add the following lines to the end of the file, then save and close export INCLUDE_PATH=/build/install-files/include:$INCLUDE_PATH export LD_LIBRARY_PATH=/build/install-files/lib:$LD_LIBRARY_PATH... g++ 'pkg-config opencv cflags' hello _opencv. cpp -o hello _opencv 'pkg-config opencv libs' 2 Run the compiled code by /hello _opencv Note that you need to have an image called “image.jpg” in the same directory for this program to run Installing Without Superuser Privileges Many times you do not have superuser access privileges to the computer you are working on You can still install and use OpenCV, ... LD_LIBRARY_PATH=/build/install-files/lib:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/build/install-files/lib/pkgconfig:$PKG_CONFIG_PATH where can for example be /home/user/libraries /opencv/ 1 Reboot your computer 2 You can now compile and use OpenCV code as mentioned previously, like a normal install Using an Integrated Development Environment... to OPENCV_ DIR/build/bin and doing /cpp-example-camshiftdemo However, camshift always tries to find an instance of the object If the object is not present, it shows the nearest match as a detection (see Figure 3-4 ) 13 Chapter 3 ■ CV Bling OpenCV Inbuilt Demos Figure 3-1 . Camshift object tracking—specifying the object to be tracked Figure 3-2 . Camshift object tracking 14 Chapter 3 ■ CV Bling OpenCV. .. (Recall that higher disparity means lesser distance from the camera.) You can run the demo on the famous Tsukuba images by /cpp-example-stereo_match OPENCV_ DIR/samples/cpp/tsukuba_l.png OPENCV_ DIR/samples/cpp/tsukuba_r.png where OPENCV_ DIR is the path to OPENCV_ DIR Figure 3-5 . OpenCV stereo matching Homography Estimation in Video The video_homography demo uses the FAST corner detector to detect interest... ./cpp-example-minarea Figure 3-1 1 Bounding box and circle Image Inpainting Image inpainting is replacing certain pixels in the image with surrounding pixels It is mainly used to repair damages to images such as accidental brush-strokes The OpenCV inpaint demo allows you to vandalize an image by making white marks on it and then runs the inpainting algorithm to repair the damages ./cpp-example-inpaint OPENCV_ DIR/samples/cpp/fruits.jpg... constructor, and OpenCV will play the video in that file for you exactly in the same manner (see Listing 4-5 ) Listing 4-5 . Program to display video from a file // Program to display a video from a file // Author: Samarth Manoj Brahmbhatt, University of Pennsylvania // Video from: http://ftp.nluug.nl/ftp/graphics/blender/apricot/trailer/sintel_trailer-480p.mp4 #include using... In OpenCV a rectangular ROI is specified using a rect structure (again, look for rect in the OpenCV docs) We need the top-left corner position, width and height to define a rect Let us take a look at the code for our application (Listing 4-3 ) and then analyze it a bit at a time Listing 4-3 . Cropping a part out of an image // Program to crop images using GUI mouse callbacks // Author: Samarth Manoj Brahmbhatt, . enable-gpl enable-libfaac enable-libmp3lame –-enable-libopencore-amrnb enable-libopencore-amrwb enable-libtheora enable-libvorbis –-enable-libx264 enable-libxvid enable-nonfree enable-postproc. –-enable-libopencore-amrwb enable-libtheora enable-libvorbis enable-libx264 enable-libxvid enable-nonfree enable-postproc enable-version3 enable-x11grab –-enable-shared –-enable-pic Chapter 2 ■ Setting up OpenCV. libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg 3. Remove any installed versions of ffmpeg and x264 sudo apt-get