Building the analyzer

The CheckersModel module is the eyes and the brain of our project. It brings together everything except the GUI. Specifically, it depends on NumPy, OpenCV, scikit-learn, and our ColorUtils and ResizeUtils modules, as reflected in the following import statements:

import numpy
import sklearn.cluster
from CVBackwardCompat import cv2

import ColorUtils
import ResizeUtils

Note

Although we are combining image capturing and analysis into one module, they are arguably distinct responsibilities. For this project, they share a dependency on OpenCV. However, in a future project, you might capture images from a camera that requires another library, or from an entirely different type of source, such as a network. You might even support a ...

Get Python Game Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.