IntroductionIn this article, using OpenCV with wxWidgets is discussed with examples. For that, OpenCV and wxWidgets need to be installed in your system. Installing and using them on Linux and Windows platforms can be found at the following links.
- Cross-platform C++ programming with wxWidgets
- OpenCV on Linux using g++, CMake, Qt, Code::Blocks
- OpenCV on Windows Using Visual Studio
LinuxBuilding an application using OpenCV and wxWidgets in Linux terminal is simple. As an example, a simple program called wxcvsimple.cpp (online) is discussed below. At the start of the program, in OnInit() method of the Application,
wxInitAllImageHandlers();is called. Then, wxStaticBitmap variables are declared in MyFrame class, a derived class of wxFrame, to display images. The following code can be used to initialize wxStaticBitmap in the constructor of MyFrame class.