Highgui Graphical User interface

Source: Internet
Author: User

Refer to the introduction to self-opencv3 programming book

Graphical user interface main content includes image loading, display and output to file

In the opencv1.0 era, the storage structure of images is Iplimagex after 2.0, and the Mat class is used as the data structure of image storage.

1,mat class

The size is 0 by default and can be specified in size, Mat (200,600,scalar::all (0));

2, image loading and display

Imread and Imshow

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

FileName: File name

Flag: Loading Signs

Enumeration can be found in higui_c.h

Enum

{

Cv_load_image_grayscale = 0, 8-bit grayscale image

Cv_load_image_color = 1, color map

cv_load_image_anydepth=2, returns the image of the corresponding depth

Cv_load_image_anycolor=4, returns an image of the object's color

}

Flag is an int type variable

Flag >0 Returns a 3-channel color image

Flag = 0 Returns a grayscale image

Flag>0 returns an image of an alpha channel

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

Winname: The name of the window

Mat: Images that need to be displayed

3, create window: Namedwindow function

Prototype: void Namedwindow (const string &winname,int flag = window_autosize)

Winname: Window Name

Flag: Window Marking

Window_normal This value the user can change the size of the window

The Window_autosize window automatically adjusts the adaptive image

4, Output image to file: Imwrite function

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

FileName: File name
Params: for JPEG picture parameters, the image quality from 0 to 100 is 95 by default, and for PNG pictures This parameter indicates that the compression level from 0-9 is 3 by default.

Highgui Graphical User interface

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.