- This project uses Raspberry Pi Zero 2W as a Server that takes still images with Pi Camera 3.
- This project uses the Neopixel ring LED for illumination and the PiSugar project for UPS (optional).
- Clients on any platform can request photos to be taken and sent over.
- One use case is to read the pH according to the text and colour scheme on the pH scale.
This package is composed of two main components: a server
to be run on a Raspberry Pi with a camera, and a client
that can be run on any computer to request and analyze photos.
You can install the components separately depending on your needs.
-
Clone the repository:
git clone https://github.com/cyrilcaoyang/pizerocam/ cd pizerocam
-
Create a virtual environment: It is recommended to use the
--system-site-packages
flag to have access to system-level packages likepicamera2
.python3 -m venv venv --system-site-packages source venv/bin/activate
-
Install the server package: This will install the server and all its dependencies.
pip install .[server]
-
Clone the repository:
git clone https://github.com/cyrilcaoyang/pizerocam/ cd pizerocam
-
Create a Conda environment:
conda create -n pizerocam-client python=3.9 conda activate pizerocam-client
-
Install the client package: You have two options for installing the client, depending on which OCR engine you want to use.
Option 1: Tesseract (Local OCR) This option uses the Tesseract engine to perform OCR locally on your machine.
pip install .[client-tesseract]
Note on Tesseract: You need to have Google's Tesseract OCR engine installed on your system. You can find installation instructions here: Tesseract Installation
Option 2: Google Cloud Vision (Cloud-based OCR) This option uses the Google Cloud Vision API for OCR.
pip install .[client-gcloud]
Note on Google Cloud: You will need to set up a Google Cloud Platform project with the Vision API enabled and configure your authentication.
If you want to install all components for development (server, and both client types), you can use Conda for simplicity.
-
Create a Conda environment:
conda create -n pizerocam-dev python=3.9 conda activate pizerocam-dev
-
Install packages:
pip install .[server,client-tesseract,client-gcloud]
Navigate to the src/picam_server
directory and run the server:
python server.py
Navigate to the src/image_client
directory and run the interactive client:
python photo_client.py
Please follow the instructions (to be added #TODO) to set up the Pi Zero
Pi Zero has limited RAM; SHH using the command-line interface (CLI) is recommended.
However, you can also use the Pi Connect Service to connect to Pi Zero.
-
Assemble the hardware components.
-
Make sure to turn on under SPI and I2C:
sudo raspi-config
"Interface Options" -> turn on both SPI and I2C options
If you are using PiSugar:
wget https://cdn.pisugar.com/release/pisugar-power-manager.sh bash pisugar-power-manager.sh -c release
PiSugar will establish a web server through which you can check your battery status. Use the link at the end of the installation.
-
Clone this repo;
git clone https://github.com/cyrilcaoyang/pizerocam/
-
Create a Python environment (it will be outside of the project folder, this will take some time)
python -m venv picam_env --system-site-packages
Make sure to use the flag at the end, otherwise, picamera2 package cannot be recognized.
-
Activate the venv
source picam_env/bin/activate
-
(Optional) Activate the environment every login session(SSH):
nano ~/.profile
Add the following line:
source PATH_TO_ENVIRONMENT/bin/activate
Apply changes:
source ~/.profile
-
Install the LED driver code
pip3 install adafruit-circuitpython-neopixel pyyaml
-
Just navigate to the server.py code and start the server
python server.py
-
It is recommended to use the Conda environment (to be added)
-
Clone and install the sdl_utils package.
clone ~~~~ pip install -e .
-
For the demo, Python Imaging Library (PIL) (or the Pillow fork)
pip install pillow
Download and install Tesseract for OCR (which requires Python 3.6+)
- github.com/UB-Mannheim/tesseract/wiki
-
Clone and install this package. DO pip install so you get all the required packages.
clone https://github.com/cyrilcaoyang/pizerocam/ pip install -e .
-
Navigate to the client.py code and start the client
python client.py