Skip to content

Commit

Permalink
Change to espressif camera repo. Improved Readme and example
Browse files Browse the repository at this point in the history
  • Loading branch information
cnadler86 committed Nov 19, 2024
1 parent 680411a commit 76f8c1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ESP32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ jobs:
cd esp-idf
./install.sh all
cd components
# latest_cam_driver=$(curl -s https://api.github.com/repos/espressif/esp32-camera/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# git clone --depth 1 --branch $latest_tag https://github.com/espressif/esp32-camera.git
git clone https://github.com/cnadler86/esp32-camera.git
latest_cam_driver=$(curl -s https://api.github.com/repos/espressif/esp32-camera/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
git clone --depth 1 --branch $latest_tag https://github.com/espressif/esp32-camera.git
# git clone https://github.com/cnadler86/esp32-camera.git
cd ~/esp-idf/
source ./export.sh
Expand Down
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![ESP32 Port](https://github.com/cnadler86/micropython-camera-API/actions/workflows/ESP32.yml/badge.svg)](https://github.com/cnadler86/micropython-camera-API/actions/workflows/ESP32.yml)

This project aims to support various cameras on different MicroPython ports, starting with the ESP32 port and Omnivision (OV2640 & OV5640) cameras. The project implements a general API for cameras in micropython (such as circuitpython have done).
This project aims to support various cameras (e.g. OV2640, OV5640) on different MicroPython ports, starting with the ESP32 port. The project implements a general API, has precompiled FW images and supports a lot of cameras out of the box.
At the moment, this is a micropython user module, but it might get in the micropython repo in the future.
The API is stable, but it might change without previous announce.

Expand Down Expand Up @@ -141,6 +141,10 @@ import camera
vers = camera.Version()
```

### Additional information

The FW images support the following cameras out of the box, but is therefore big: OV7670, OV7725, OV2640, OV3660, OV5640, NT99141, GC2145, GC032A, GC0308, BF3005, BF20A6, SC030IOT

## Build your custom FW

### Setting up the build environment (DIY method)
Expand All @@ -149,11 +153,11 @@ To build the project, follow these instructions:

- [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/v5.2.3/esp32/get-started/index.html): I used version 5.2.3, but it might work with other versions (see notes).
- Clone the micropython repo and this repo in a folder, e.g. "MyESPCam". MicroPython version 1.24 or higher is required (at least commit 92484d8).
- You will have to add the ESP32-Camera driver (I used v2.0.13). To do this, add the following to the respective idf_component.yml file (e.g. in micropython/ports/esp32/main_esp32s3/idf_component.yml):
- You will have to add the ESP32-Camera driver (I used v2.0.15). To do this, add the following to the respective idf_component.yml file (e.g. in micropython/ports/esp32/main_esp32s3/idf_component.yml):

```yml
espressif/esp32-camera:
git: https://github.com/cnadler86/esp32-camera #At the moment I maintain a fork because of some unsolved bugs and conveniance.
git: https://github.com/espressif/esp32-camera.git
```
Alternatively, you can clone the <https://github.com/cnadler86/esp32-camera> repository inside the esp-idf/components folder instead of altering the idf_component.yml file.
Expand Down Expand Up @@ -221,6 +225,9 @@ Example for Xiao sense:
#define MICROPY_CAMERA_GRAB_MODE (1) // 0=WHEN_EMPTY (might have old data, but less resources), 1=LATEST (best, but more resources)

```
#### Customize additional camera settings

If you want to customize additional camera setting or reduce the FW size by removing support for unused camera sensors, then take a look at the kconfig file of the esp32-camera driver and specify these on the sdkconfig file of your board.

### Build the API

Expand Down Expand Up @@ -268,6 +275,14 @@ Using fb_count=2 theoretically can double the FPS (see JPEG with fb_count=2). Th


Looking at the results: image conversion make only sense for frame sized below QVGA or if capturing the image in the intended pixelformat and frame size combination fails.

## Troubleshoot

You can find information on the following sites:
- [ESP-FAQ](https://docs.espressif.com/projects/esp-faq/en/latest/application-solution/camera-application.html)
- [ChatGPT](https://chatgpt.com/)
- [Issues in here](https://github.com/cnadler86/micropython-camera-API/issues?q=is%3Aissue)

## Future Plans

- Edge case: enable usage of pins such as i2c for other applications
Expand Down
3 changes: 2 additions & 1 deletion examples/CameraSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ async def stream_camera(writer):
cam.init()
if not cam.get_bmp_out() and cam.get_pixel_format() != PixelFormat.JPEG:
cam.set_bmp_out(True)

await asyncio.sleep(1)

writer.write(b'HTTP/1.1 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=frame\r\n\r\n')
await writer.drain()

Expand Down

0 comments on commit 76f8c1a

Please sign in to comment.