Grabbing camera frames from the serial port with Python
In the previous recipe, we showed how to take images from the OV7670, but we didn’t provide a method to display them. Therefore, it is now the time to implement a Python script locally to read the pixel values transmitted serially and show the resulting image on the screen.
Getting ready
In this recipe, we will develop a Python script locally to create images from the data transmitted over the serial. To facilitate this task, we will need two main Python libraries:
- pySerial, which allows us to read the data transmitted serially
- Pillow (https://pypi.org/project/Pillow), which enables us to create image files from the received data
The Pillow library is a fork of the Python Imaging Library (PIL) and can be installed with the following pip
command:
$ pip install Pillow
Using the fromarray()
method provided by this library, we can generate images from NumPy arrays that hold...