Today the bridal suite, tomorrow a prison. A secret agent's sleeping arrangements are horribly unpredictable.
Each day someone in MI6 gets the job of booking a stellar hotel room and conversely, some evil henchman has to pick a warehouse or dilapidated apartment, plus a lamp, a chair, and implements of bondage. For mini missions or brief beatings, it is tolerable to leave the choice of venue to a fallible human being. However, for long-term rentals or acquisitions, would it not be wiser to develop a specialized search engine that takes the legwork and the guesswork out of the equation?
With this motivation, we are going to develop a desktop app called Luxocator: The Luxury Locator. This is a search engine that will find images on the web by keyword search and will classify each image as a "Luxury, interior" scene, "Luxury, exterior" scene, "Stalinist, interior" scene, or "Stalinist, exterior" scene, according to certain visual cues in the image.
Particularly, our classifier relies on comparing statistical distributions of color in different images or sets of images. This topic is called color histogram analysis. We will learn how to efficiently store and process our statistical model, and how to redistribute it along with our code in an application bundle.
The completed project for this chapter can be downloaded from my website at http://nummist.com/opencv/7376_02.zip.
This chapter uses Python. Being a high-level interpreted language with great third-party libraries for numeric and scientific computing, Python lets us focus on the functionality of the system rather than implementing subsystem details. For our first project, such a high-level perspective is precisely what we need.
Let's take an overview of Luxocator's functionality and our choice of Python libraries that support this functionality. Like many computer vision applications, Luxocator has 6 basic steps:
Optionally, we will use PyInstaller to build Luxocator so that it can be deployed to users who do not have Python or the aforementioned libraries. However, remember that you might need to do extra troubleshooting of your own to make PyInstaller work in some environments, including Raspberry Pi or other ARM devices.