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> ¶ms =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