Book Image

OpenCV for Secret Agents

By : Joseph Howse
Book Image

OpenCV for Secret Agents

By: Joseph Howse

Overview of this book

Table of Contents (15 chapters)
OpenCV for Secret Agents
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Integrating everything into the GUI


For Luxocator's frontend, let's create a file called Luxocator.py. This module depends on OpenCV, wxPython, and some of Python's standard OS and threading functionality. It also depends on all the other modules that we have written in this chapter. Add the following import statements at the top of the file:

import numpy
import cv2
import os
import threading
import wx

from HistogramClassifier import HistogramClassifier
from ImageSearchSession import ImageSearchSession
import PyInstallerUtils
import ResizeUtils
import WxUtils

Now, let's implement the Luxocator class as a subclass of wx.Frame, which represents a GUI frame such as the contents of a window. Most of our GUI code is in the Luxocator class's __init__ method, which is therefore a big method but is not very complicated. Our GUI elements include a search control, previous and next buttons, a bitmap, and a label to show the classification result. All of these GUI elements are stored in the member variables...