In Chapter 2, Searching for Luxury Accommodations Worldwide, we wrote a file, WxUtils.py, that contains a utility function, wxBitmapFromCvImage, to convert OpenCV images to wxPython bitmaps. We used this utility function in our Python projects throughout this book.
Our implementation of wxBitmapFromCvImage relied in part on wxPython's wx.BitmapFromBuffer function. On some versions of Raspberry Pi and Raspbian, wx.BitmapFromBuffer suffers from a platform-specific bug that causes it to fail. As a workaround, we can do a less efficient, two-step conversion using the wx.ImageFromBuffer and wx.BitmapFromImage functions. Here is some code to check whether we are running on an early model of Raspbperry Pi (based on the CPU model) and to implement our wxBitmapFromCVImage function appropriately:
import numpy # Hint to PyInstaller
import...