Codeblocksopencv2.4.9 configuration in ubuntu

Source: Internet
Author: User
This article is for reference only. The configuration varies with the installation path of opencv and codeblocks. 1. Install CodeBlocks to install codeblocks [plain] viewplaincopyprint? # Apt-getinstallcodeblocks-contrib # wxWidgets # apt-getinstalllibwxbase2.8-dev #

This article is for reference only. The configuration varies with the installation path of opencv and codeblocks. 1. Install CodeBlocks to install codeblocks [plain] view plaincopyprint? # Apt-getinstallcodeblocks-contrib # wxWidgets # apt-getinstalllibwxbase2.8-dev #

This article is for reference only. The configuration varies with the installation path of opencv and codeblocks.

1. Install CodeBlocks

Install codeblocks

[Plain]View plaincopyprint?

  1. # Apt-get install codeblocks
  2. # Apt-get install codeblocks-contrib # wxWidgets seems to be used
  3. # Apt-get install libwxbase2.8-dev # Or wxWidgets stuff


Ii. Install opencv

1. First query opencv:

[Plain]View plaincopyprint?

  1. ~ # Apt-cache search opencv
  2. Libcv-dev-Translation package for libcv-dev
  3. Libcv2.3-computer vision library-libcv * translation package
  4. Libcvaux-dev-Translation package for libcvaux-dev
  5. Libcvaux2.3-computer vision library-libcvaux translation package
  6. Libhighgui-dev-Translation package for libhighgui-dev
  7. Libhighgui2.3-computer vision library-libhighgui translation package
  8. Libopencv-calib3d-dev-development files for libopencv-calib3d
  9. Libopencv-calib3d2.3-computer vision Camera Calibration library
  10. Libopencv-contrib-dev-development files for libopencv-contrib
  11. Libopencv-contrib2.3-computer vision contrib library
  12. Libopencv-core-dev-development files for libopencv-core
  13. Libopencv-core2.3-computer vision core library
  14. Libopencv-dev-development files for opencv
  15. Libopencv-features2d-dev-development files for libopencv-features2d
  16. Libopencv-features2d2.3-computer vision Feature Detection and Descriptor Extraction library
  17. Libopencv-flann-dev-development files for libopencv-flann
  18. Libopencv-flann2.3-computer vision Clustering and Search in Multi-dimenstmspaces library
  19. Libopencv-gpu-dev-development files for libopencv-gpu
  20. Libopencv-gpu2.3-computer vision GPU Processing library
  21. Libopencv-highgui-dev-development files for libopencv-highgui
  22. Libopencv-highgui2.3-computer vision High-level GUI and Media I/O library
  23. Libopencv-imgproc-dev-development files for libopencv-imgproc
  24. Libopencv-imgproc2.3-computer vision Image Processing library
  25. Libopencv-legacy-dev-development files for libopencv-legacy
  26. Libopencv-legacy2.3-computer vision legacy library
  27. Libopencv-ml-dev-development files for libopencv-ml
  28. Libopencv-ml2.3-computer vision Machine Learning library
  29. Libopencv-objdetect-dev-development files for libopencv-objdetect
  30. Libopencv-objdetect2.3-computer vision Object Detection library
  31. Libopencv-video-dev-development files for libopencv-video
  32. Libopencv-video2.3-computer vision Video analysis library
  33. Opencv-doc-OpenCV documentation and examples
  34. Python-opencv-Python bindings for the computer vision library


2. Install the SDK Based on the query results.

[Plain]View plaincopyprint?

  1. # Apt-get install libcv2.3 libcvaux2.3 libhighgui2.3
  2. # Apt-get install libcv-dev libcvaux-dev libhighgui-dev




3. codeblocks + opencv Configuration

1. Related File Location

~ # Pkg-config -- cflags opencv # location of the opencv header file (. h)
-I/usr/include/opencv

~ # Pkg-config -- libs opencv # opencv Library File
-Lopencv_core-lower-lopencv_highgui-lopencv_ml-lopencv_video-lower-lopencv_calib3d-lopencv_objdetect-lopencv_contrib-lopencv_legacy-lopencv_flann


2. codeBlocks Link Library configuration: Project-> Build Options, for example:



3. codeBlocks header file directory configuration (pkg-config -- cflags opencv result)


4. CodeBlocks path file directory Configuration


5. Test Results



4. Program demonstration

Not yet... (the picture cannot be displayed. Sorry to post it. Sorry ...)

After trying to find the Encoding Error, the result is obtained (the result is finally displayed by ainemo ):


V. Sample Code

[Cpp]View plaincopyprint?

  1. # Include "cv. h"
  2. # Include "highgui. h"
  3. Int main ()
  4. {
  5. IplImage * pImg;
  6. PImg = cvLoadImage ("/home/nehc/fish.jpg", 1 );
  7. CvNamedWindow ("Image", 1 );
  8. CvShowImage ("Image", pImg );
  9. CvWaitKey (0 );
  10. CvDestroyWindow ("Image ");
  11. CvReleaseImage (& pImg );
  12. Return 0;
  13. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.