You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project aims to support cameras in different ports in micropython, 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).
3
5
At the moment, this is a micropython user module, but it might get in the micropython repo in the future.
4
6
The API is stable, but it might change without previous anounce.
5
7
6
-
## Precomiled FW (the easy way) (work in progress)
7
-
If you are not familiar with building a custom firmware, you can go to the actions tab and start the build workflow by yourself. Then, you can download one of the generic FWs that suits your board.
8
+
## Precomiled FW (the easy way)
9
+
If you are not familiar with building a custom firmware, you can go to the [releases](https://github.com/cnadler86/micropython-camera-API/releases) page and download one of the generic FWs that suits your board.
10
+
11
+
## Using the API
12
+
```python
13
+
from camera import Camera, GrabMode, PixelFormat, FrameSize, GainCeiling
14
+
15
+
# Camera construction and initialization
16
+
camera = Camera(
17
+
data_pins=[1,2,3,4,5,6,7,8],
18
+
vsync_pin=9,
19
+
href_pin=10,
20
+
sda_pin=11,
21
+
scl_pin=12,
22
+
pclk_pin=13,
23
+
xclk_pin=14,
24
+
xclk_freq=20000000,
25
+
powerdown_pin=-1,
26
+
reset_pin=-1,
27
+
pixel_format=PixelFormat.RGB565,
28
+
frame_size=FrameSize.QVGA,
29
+
jpeg_quality=15,
30
+
fb_count=1,
31
+
grab_mode=GrabMode.WHEN_EMPTY
32
+
)
33
+
34
+
#Camera construction using defaults (if you specified them in mpconfigboard.h)
You can get and set sensor properties by the respective methods (e.g. camera.get_brightness() or camera.set_vflip(True). See autocompletitions in Thonny in order to see the list of methods.
46
+
If you want more insides in the methods and what they actually do, you can find a very good documentation [here](https://docs.circuitpython.org/en/latest/shared-bindings/espcamera/index.html).
47
+
Notice that for the methods in here you need to prefix a get/set, depending that you want to do.
8
48
9
-
## Setup build environment (the DIY way)
49
+
## Build your custom FW
50
+
### Setup build environment (the DIY way)
10
51
To build the project, follow the following instructions:
11
-
-[ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/v5.2.2/esp32/get-started/index.html): I used version 5.2.2, but it might work with other versions.
52
+
-[ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/v5.2.3/esp32/get-started/index.html): I used version 5.2.2, but it might work with other versions (see notes).
12
53
- Clone the micropython repo and this repo in a folder, e.g. "MyESPCam". I used the actual micropython master branch (between v1.23 and before 1.24).
13
54
- You will have to add the ESP32-Camera driver (I used v2.0.12). To do this, add the following to the respective idf_component.yml file (e.g. in micropython/ports/esp32/main_esp32s3/idf_component.yml):
14
55
```
@@ -17,7 +58,7 @@ To build the project, follow the following instructions:
17
58
```
18
59
You can also clone the https://github.com/espressif/esp32-camera repository inside the esp-idf/components folder instead of altering the idf_component.yml file.
19
60
20
-
## Add camera configurations to your board (Optional, but recomended)
61
+
###Add camera configurations to your board (Optional, but recomended)
21
62
To make things easier, add the following lines to your board config-file "mpconfigboard.h" with the respective pins and camera parameters. Otherwise you will need to pass all parameters during construction.
22
63
Don't forget the empty line at the buttom.
23
64
Example for xiao sense:
@@ -46,52 +87,17 @@ Example for xiao sense:
46
87
47
88
```
48
89
49
-
## Build the API
90
+
###Build the API
50
91
To build the project, you could do it the following way:
51
92
52
93
```bash
53
94
$ .<path2esp-idf>/esp-idf/export.sh
54
95
$ cd MyESPCam/micropython/ports/esp32
55
-
$ make USER_C_MODULES=../../../../mp_camera/src/micropython.cmake BOARD=<Your-Board> clean
56
-
$ make USER_C_MODULES=../../../../mp_camera/src/micropython.cmake BOARD=<Your-Board> submodules
57
-
$ make USER_C_MODULES=../../../../mp_camera/src/micropython.cmake BOARD=<Your-Board> all
96
+
$ make USER_C_MODULES=../../../../micropython-camera-API/src/micropython.cmake BOARD=<Your-Board> clean
97
+
$ make USER_C_MODULES=../../../../micropython-camera-API/src/micropython.cmake BOARD=<Your-Board> submodules
98
+
$ make USER_C_MODULES=../../../../micropython-camera-API/src/micropython.cmake BOARD=<Your-Board> all
58
99
```
59
100
if you experience problems, visit [MicroPython external C modules](https://docs.micropython.org/en/latest/develop/cmodules.html).
60
101
61
-
## Using the API
62
-
```python
63
-
from camera import Camera, GrabMode, PixelFormat, FrameSize, GainCeiling
64
-
65
-
# Camera construction and initialization
66
-
camera = Camera(
67
-
data_pins=[1,2,3,4,5,6,7,8],
68
-
vsync_pin=9,
69
-
href_pin=10,
70
-
sda_pin=11,
71
-
scl_pin=12,
72
-
pclk_pin=13,
73
-
xclk_pin=14,
74
-
xclk_freq=20000000,
75
-
powerdown_pin=-1,
76
-
reset_pin=-1,
77
-
pixel_format=PixelFormat.RGB565,
78
-
frame_size=FrameSize.QVGA,
79
-
jpeg_quality=15,
80
-
fb_count=1,
81
-
grab_mode=GrabMode.WHEN_EMPTY
82
-
)
83
-
84
-
#Camera construction using defaults (if you specified them in mpconfigboard.h)
You can get and set sensor properties by the respective methods (e.g. camera.get_brightness() or camera.set_vflip(True). See autocompletitions in Thonny in order to see the list of methods.
96
-
If you want more insides in the methods and what they actually do, you can find a very good documentation [here](https://docs.circuitpython.org/en/latest/shared-bindings/espcamera/index.html).
97
-
Notice that for the methods in here you need to prefix a get/set, depending that you want to do.
102
+
## Notes
103
+
If your target board is a ESP32, I recomend using IDF >= 5.2, since older versions may lead to IRAM overflow during build. Alternatively you can modify your sdkconfig-file (see [issue #1](https://github.com/cnadler86/micropython-camera-API/issues/1)).
0 commit comments