O'Reilly logo

OpenCV By Example by Vinícius Godoy, David Millán Escrivá, Prateek Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A basic graphical user interface with OpenCV

We are going to create a basic user interface with OpenCV. The OpenCV user interface allows us to create windows, add images to it, move it, resize it, and destroy it.

The user interface is in the OpenCV's module called highui:

#include <iostream> #include <string> #include <sstream> using namespace std; // OpenCV includes #include "opencv2/core.hpp" #include "opencv2/highgui.hpp" using namespace cv; const int CV_GUI_NORMAL= 0x10; int main( int argc, const char** argv ) { // Read images Mat lena= imread("../lena.jpg"); Mat photo= imread("../photo.jpg"); // Create windows namedWindow("Lena", CV_GUI_NORMAL); namedWindow("Photo", WINDOW_AUTOSIZE); // Move window moveWindow("Lena", 10, 10); moveWindow("Photo", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required