O'Reilly logo

Python Game Programming By Example by Joseph Howse, Alejandro Rodas de Paz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required