LINUX Open CV exercises using small notes (1)

Source: Internet
Author: User

First of all, you must choose a favorite image to display

#include <opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>intMain () {//Read an imageCv::mat image= Cv::imread (".. /img.jpg"); //Create image window named "My image"Cv::namedwindow ("My Image"); //Show the image on windowCv::imshow ("My Image", image); //wait key for MsCv::waitkey ( the); return 1;}

Note here the path img.jpg to modify Ah, if you do not have time to see the Linux file system people directly in the program to write the folder of the upper-level path, their own copy of a img.jpg

It is also recommended to build a file in the programming folder.

1 #!/bin/sh2 3 if[ $#-GT 0]; Then4Base= ' basename $. C '5Echo"compiling $base"6Gcc-ggdb ' pkg-config opencv--cflags--libs '$base. c-o$base7 Else8      forIinch*.C; Do9Echo"compiling $i"TenGcc-ggdb ' pkg-config--cflags opencv '-O ' basename$i. C '$i' Pkg-config--Libs OpenCV '; One  Done A      forIinch*.cpp; Do -Echo"compiling $i" -g++-ggdb ' pkg-config--cflags opencv '-O ' basename$i. cpp '$i' Pkg-config--Libs OpenCV '; the  Done -Fi

By the time, the execution instructions

./build_all.sh

Don't have to play that long code (please ignore the veteran)

LINUX Open CV exercises using small notes (1)

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.