(i) Ubuntu under Qtcreator +opencv to create a new project and invoke Caffe environment configuration __caffe

Source: Internet
Author: User
First, create a project with Qtcreator

1. New Project

2. Select project Type

3, modify the project name and project storage address

4. Next, select Next until the project builds successfully
second, after the successful project creation, began to write OpenCV small program

1, in the Pro configuration file to add OpenCV Library directory

Includepath + +/usr/local/include \
/usr/local/include/opencv \
/usr/local/include/opencv2

2, in the Pro configuration file to add OpenCV dynamic library links

LIBS + +/usr/local/lib/libopencv_calib3d.so \
/usr/local/lib/libopencv_core.so \
/usr/local/lib/libopencv_ features2d.so \
/usr/local/lib/libopencv_flann.so \
/usr/local/lib/libopencv_highgui.so \
/usr/local/ lib/libopencv_imgcodecs.so \
/usr/local/lib/libopencv_imgproc.so \
/usr/local/lib/libopencv_ml.so \
/ usr/local/lib/libopencv_objdetect.so \
/usr/local/lib/libopencv_photo.so \
/usr/local/lib/libopencv_ shape.so \
/usr/local/lib/libopencv_stitching.so \
/usr/local/lib/libopencv_superres.so \
/usr/ local/lib/libopencv_videoio.so \
/usr/local/lib/libopencv_video.so \
/usr/local/lib/libopencv_ Videostab.so

QT OPENCV Configuration Complete

3, in Main.cpp to write the first OpenCV applet, display a picture

#include <cstdlib>
#include <iostream>
#include <opencv2/opencv.hpp>
#include < opencv2/core/core.hpp>  
#include <opencv2/highgui/highgui.hpp>  
using namespace std;
using namespace CV;
int main (int argc, char* argv[])
{
    cv::mat img;//define a MAT variable
    img = Cv::imread ("/home/1.jpg");//Read Picture
    CV :: Imshow ("Window", IMG);        Display Picture
    cv::waitkey (0);
    return 0;
}

Display picture, OPENCV configuration successful

Three, the configuration of Qt Caffe
1, in the Pro profile to join the Caffe Library directory

Includepath + = Caffe's home directory/include \   
               Caffe's home directory/build/src 
               #caffe的库目录每个人根据自己目录填写, such as/home/caffe

2, in the Pro profile to join Caffe Dynamic link library

LIBS = L Caffe's home directory/build/lib \
LIBS + = Lcaffe

Note: LIBCAFFE.SO.1.0.0-RC3 According to the version of Caffe, to enter the Lib directory to see its name, changed to the same as it.
3, pro under Cuda, CUDNN configuration (note that only the installation of Cuda or CUDNN to configure this step)

Includepath +/usr/local/cuda/include \
LIBS =-l/usr/local/cuda/lib64
LIBS + =-lcudart-lcublas-lcurand

4, pro file Caffe related dependencies to join

LIBS + +-lglog-lgflags-lprotobuf-lboost_system-lboost_thread-llmdb-lleveldb-lstdc++-lcblas-latlas

5, after the above configuration, Qtcreator under the Caffe configuration completed.

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.