Configure opencv and codeblocks development environment in Ubuntu

Source: Internet
Author: User
Tags wxwidgets

Ubuntu 12.04, codeblocks 10.05, and opencv 2.3 (source 163.com, this does not seem to be declared)

1. Install codeblocks

Install codeblocks

# Apt-Get install codeblocks-contrib # wxWidgets seems to be used # apt-Get install libwxbase2.8-dev # Or wxWidgets stuff

Ii. Install opencv

1. First query opencv:

~# apt-cache search opencvlibcv-dev - Translation package for libcv-devlibcv2.3 - computer vision library - libcv* translation packagelibcvaux-dev - Translation package for libcvaux-devlibcvaux2.3 - computer vision library - libcvaux translation packagelibhighgui-dev - Translation package for libhighgui-devlibhighgui2.3 - computer vision library - libhighgui translation packagelibopencv-calib3d-dev - development files for libopencv-calib3dlibopencv-calib3d2.3 - computer vision Camera Calibration librarylibopencv-contrib-dev - development files for libopencv-contriblibopencv-contrib2.3 - computer vision contrib librarylibopencv-core-dev - development files for libopencv-corelibopencv-core2.3 - computer vision core librarylibopencv-dev - development files for opencvlibopencv-features2d-dev - development files for libopencv-features2dlibopencv-features2d2.3 - computer vision Feature Detection and Descriptor Extraction librarylibopencv-flann-dev - development files for libopencv-flannlibopencv-flann2.3 - computer vision Clustering and Search in Multi-Dimensional spaces librarylibopencv-gpu-dev - development files for libopencv-gpulibopencv-gpu2.3 - computer vision GPU Processing librarylibopencv-highgui-dev - development files for libopencv-highguilibopencv-highgui2.3 - computer vision High-level GUI and Media I/O librarylibopencv-imgproc-dev - development files for libopencv-imgproclibopencv-imgproc2.3 - computer vision Image Processing librarylibopencv-legacy-dev - development files for libopencv-legacylibopencv-legacy2.3 - computer vision legacy librarylibopencv-ml-dev - development files for libopencv-mllibopencv-ml2.3 - computer vision Machine Learning librarylibopencv-objdetect-dev - development files for libopencv-objdetectlibopencv-objdetect2.3 - computer vision Object Detection librarylibopencv-video-dev - development files for libopencv-videolibopencv-video2.3 - computer vision Video analysis libraryopencv-doc - OpenCV documentation and examplespython-opencv - Python bindings for the computer vision library

2. Install the SDK Based on the query results.

#  apt-get install libcv2.3 libcvaux2.3 libhighgui2.3#  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

#include "cv.h"#include "highgui.h"int main(){IplImage* pImg;pImg = cvLoadImage("/home/nehc/fish.jpg", 1);cvNamedWindow("Image", 1);cvShowImage("Image", pImg);cvWaitKey(0);cvDestroyWindow("Image");cvReleaseImage(&pImg);return 0;}

...
What is Paco?

-Simple but yet powerful source code package management system

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.