This project demonstrates real-time Optical Character Recognition (OCR) on the Raspberry Pi 5 platform, using the Transcend ECM300 embedded camera module. It is designed to capture live video, detect text regions, and recognize characters efficiently using the PaddleOCR framework.
- Hardware Requirements
- Install Raspberry Pi 5 OS
- Connect the ECM300 Camera
- Install IMX675 Camera Driver
- Quickly Run OCR
- Run OCR Manual
- Third-Party Licenses
-
Supported Platforms
- Raspberry Pi 5
-
Supported Cameras
- Transcend ECM300 (IMX675 sensor)
-
Recommended SD Card
- A microSD card with at least 128 GB capacity and UHS-1 speed class or higher.
Important: The ECM300 camera driver is only compatible with Raspberry Pi OS running Linux kernel version 6.12.25+rpt-rpi-2712. Using a different kernel version will result in driver incompatibility.
-
Download Raspberry Pi OS (64-bit, Debian Bookworm) dated 2025-05-13 from https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2025-05-13/2025-05-13-raspios-bookworm-arm64.img.xz
Note: This specific OS version includes the required kernel 6.12.25+rpt-rpi-2712.
-
Write the image to the microSD card using Raspberry Pi Imager.
- In the "Choose operating system" step, select "Use custom" at the bottom of the list, then choose the downloaded image file.
-
Insert the microSD card into the Raspberry Pi 5 and complete the initial setup (language, username, WiFi, etc.).
-
Important: During the OS installation process, when prompted with "Update Software" dialog:
-
After first boot, verify the kernel version:
uname -r
Expected output:
6.12.25+rpt-rpi-2712Warning: If the kernel version does not match exactly, do NOT proceed with driver installation. The camera driver will not work with other kernel versions.
-
Do NOT run system updates after installation, as this may upgrade the kernel to an incompatible version:
# DO NOT RUN THIS # sudo apt update && sudo apt upgrade
The installation script will automatically lock the kernel version to prevent accidental updates.
-
Power off the Raspberry Pi 5 completely:
sudo shutdown -h now
-
Insert the camera module as follows:
- ECM300: Insert into the CAM/DISP 1 port (the port closer to the USB-C power connector)
-
Power on the Raspberry Pi 5.
Copy the Driver_Install folder to the desktop:
cd ~/Desktop/RaspberryPi_OCR_Demo/Driver_InstallNote: Please make sure the device is connected to the Internet before running the following commands.
Option A: Automatic Installation (Recommended)
Execute the installation script:
chmod +x install_imx675.sh
./install_imx675.shThe installation will:
- Install build dependencies (meson, ninja, kernel headers, etc.)
- Clone and compile libcamera with IMX675 support
- Install kernel module and device tree overlay
- Configure system settings
- Lock kernel version to prevent incompatible updates
Installation time: Approximately 15-25 minutes depending on your SD card speed and internet connection.
Option B: Manual Installation
Refer to the manual located in:
Driver_Install/CameraDriver_Package_v1.0/docs/
Follow the step-by-step instructions in the manual for manual installation.
After installation completes successfully, reboot the system:
sudo rebootAfter reboot, verify the camera driver is working:
# List available cameras
libcamera-hello --list
# Test camera preview for 5 seconds
libcamera-vid -t 5000Expected output:
Available cameras
-----------------
0 : imx675 [2592x1944 10-bit RGGB] (/base/axi/pcie@120000/rp1/i2c@80000/imx675@1a)
Note: The camera will only appear in the list after you physically connect it in the next section.
On first run, the script will automatically create a virtual environment (.venv) and install required packages. This may take a few minutes.
cd ~/Desktop/RaspberryPi_OCR_Demo
chmod +x run_ocr_raspi.sh
./run_ocr_raspi.shDuring Live View, you can enter the following commands in the terminal:
-
Capture — Save a snapshot of the current frame:
capture pic.jpg
-
View Detect — Detect text regions in the live feed, draw red bounding boxes, and export coordinates to an XML file:
view_detect output.xml
Note: Live View pauses during detection. Enter the
viewcommand to resume. -
View Recognize — Perform OCR on captured images and display recognized text on both the terminal and the live view:
view_recognize
-
quit — Close the live view and exit the application:
quit
Navigate to the project directory and activate the virtual environment:
cd ~/Desktop/RaspberryPi_OCR_Demo
source .venv/bin/activateNote: If the virtual environment doesn't exist (or you see bash: .venv/bin/activate: No such file or directory),
Run the following commands to create it and install the required packages:
python3 -m venv .venv --system-site-packages
source .venv/bin/activate
pip install -r requirements.txtNote: Please make sure the device is connected to the Internet before running the following commands.
Display live video from the ECM300 / ECM100 camera.
Option -o controls image rotation:
0 = no rotation, 1 = 90°, 2 = 180°, 3 = 270°.
python ocr_raspberrypi.py view -o 0Detect text from a static image, draw bounding boxes, and export the coordinates to an XML file.
python ocr_raspberrypi.py image_detect -i pic.jpg -x output.xmlRecognize text from a static image and print the results in the terminal.
python ocr_raspberrypi.py image_recognize -i pic.jpgTo deactivate the virtual environment:
deactivateThis project uses PaddleOCR, which is licensed under the Apache License 2.0. You may freely use PaddleOCR for research, personal, and commercial purposes, provided that you retain the original license and copyright notice. No modifications were made to the original PaddleOCR source code.

