As mentioned in all of the chapters of the book, you need an appropriate installation of OpenCV, SciPy, and NumPY.
You can find the code that we present in this chapter at the GitHub repository at https://github.com/PacktPublishing/OpenCV-4-with-Python-Blueprints-Second-Edition/tree/master/chapter10.
When running the app with Docker, the Docker container should have appropriate access to the X11 server. This app cannot run in headless mode. The best environment to run the app with Docker is a Linux desktop environment. On macOS, you can use xQuartz (refer, to https://www.xquartz.org/) in order to create an accessible X11 server.
You can also use one of the available Docker files in the repository in order to run the app.