How to design GUI in OpenCV Console Application

asked 2015-07-27 02:08:55 -0600

Mohanraj gravatar image

I developed video based face recognition in video using OpenCV by Console Application using C++ but now i am not able to design the GUI.

Please anyone suggest me how to design the gui using OpenCV

edit retag flag offensive close merge delete

Comments

Please provide more information about your requirements, operating system, compiler ... anyway I could suggest QTLibrary or WxWidget (MFC is quite old tecnology but still valid for C++) finally you have to consider multi threading

pklab gravatar imagepklab ( 2015-07-27 05:41:10 -0600 )edit

Actually, OpenCV is NOT built for GUI purposes. You will need a different foreground like QT or MFC that calls your C++ code when hitting the interface. OpenCV itself will never have decent GUI functionality since it is not the main focus of the library.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-27 08:02:33 -0600 )edit

@StevenPuttemans, is there any way to use MFC from Microsoft Visual Studio? How to interface it with .cpp that contain coding with opencv library? Is it possible?

Aj-611 gravatar imageAj-611 ( 2015-10-05 23:46:06 -0600 )edit

@Aj-611 it is possible, but the problem with .NET languages is that you have managed and mangled code. This means that you will have to push all your code from the cpp file into the managed header file into the containers linking to the actions in your GUI. It is possible, let me say again, but it is a pain in the ass to get it to work. Best way would be to make a C++ class in OpenCV and then call that through header files inside your managed code.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-10-06 02:21:47 -0600 )edit

@Aj-611 In Visual Studio you can create a new project as "MFC Application" than add Opencv Libs to your project and use all what you want from MFC and from OpenCV. See here for a function to draw an Mat into MFC static control.

Due to you are working with video at 99% you have to plan a multi tread GUI

It seems you are newbie to MFC so you could take time to consider multiplatform Libs like WxWidget or Qt too.

PS Just to avoid confusion: WPF(Windows Form Application) is C#/NET managed code. MFC(Microsoft Foundation Class) is C++ UNmanaged code and it works fine with ocv (bgslibrary is a good example.

pklab gravatar imagepklab ( 2015-10-08 06:37:50 -0600 )edit