Cameo – an object-oriented design
Python applications can be written in a purely procedural style. This is often done with small applications, such as our basic I/O scripts, discussed previously. However, from now on, we will use an object-oriented style because it promotes modularity and extensibility.
From our overview of OpenCV's I/O functionality, we know that all images are similar, regardless of their source or destination. No matter how we obtain a stream of images or where we send it as output, we can apply the same application-specific logic to each frame in this stream. Separation of I/O code and application code becomes especially convenient in an application, such as Cameo, which uses multiple I/O streams.
We will create classes called CaptureManager
and WindowManager
as high-level interfaces to I/O streams. Our application code may use CaptureManager
to read new frames and, optionally, to dispatch each frame to one or more outputs, including a still image file, a...