The third lesson of the Mao Nebula Blog

Source: Internet
Author: User

http://blog.csdn.net/poem_qianmo/article/details/20537737

Using the OpenCV namespace, start with standard

#include <opencv2/core/core.hpp>  #include <opencv2/highgui/highgui.hpp>     using namespace CV;  

  

Storing images

Mat -type storage image data

Reading images

Mat imread (const string& filename, Intflags=1);

Intflags=1 represents a three-channel color image = 0 Represents a grayscale image

Create window

Winname window name flags can control whether the window is changed by default, depending on the image size

Show

void Imshow (const string& winname, Inputarray mat);

Inputarray can be understood as mat

Time out

Waitkey (int N)

Wait for n milliseconds and press any key to continue

Save to File

BOOL Imwrite (const string& filename,inputarray img, const vector<int>& params=vector<int> ());  

 

Practice

#include <opencv2/core/core.hpp> #include 

  

Postscript:

Before opencv2.0, only CV, such as Cvmat,iplimage,cvloadimage, and so on, and Cvmat is a struct, each call must be memory allocation, Cvmat *a = Cvcreatemat (),
Memory is freed after it is exhausted. Opencv2.0 after the addition of the C + + interface Mat Matrix, Cv::mat is a class (class), use is not allocated memory, run out and do not release, the corresponding reading picture is imread and so on.
So now we don't have to start with CVS.

    1. Select Roi,rect four parameters are (x, y) coordinates, the third parameter is the width, the fourth parameter is the height
    2. Mat ROI (Mat,rect (0,0,2,1));
    3. cout<<roi<<endl;

The third lesson of the Mao Nebula Blog

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.