Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a simple window with one button using OpenCV HighGui only?

I am working on a game-project using OpenCV. Now I have to make a simple GUI: a window with one button, using HighGui only.

I'm not sure but I think I'm supposed to use something like this:

cvNamedWindow( "NameWindow" , CV_WINDOW_AUTOSIZE);

Any help is much appreciated.

like image 211
Koci Ogon Avatar asked Nov 26 '15 11:11

Koci Ogon


1 Answers

You can now create buttons and other useful tools on OpenCV windows. The page below shows a couple of useful examples.

https://docs.opencv.org/master/dc/d46/group__highgui__qt.html

The gist of it is:

#include <opencv2/highgui.hpp>
void myButtonName_callback(int state, void*userData) {
    // do something
    printf("Button pressed\r\n");
}
createButton("myButtonName",myButtonName_callback,NULL,CV_PUSH_BUTTON,1);
like image 67
VoteCoffee Avatar answered Oct 27 '22 00:10

VoteCoffee