Skip to content

Commit 29b2b8c

Browse files
committed
camera: Fix keyword arg.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
1 parent e55eff5 commit 29b2b8c

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenMV Python
22

3-
Python library and CLI for communicating with OpenMV cameras using Protocol V2.
3+
Python library and CLI for communicating with OpenMV cameras.
44

55
## Installation
66

@@ -20,7 +20,7 @@ openmv --port /dev/ttyACM0
2020
openmv --port /dev/ttyACM0 --script my_script.py
2121

2222
# Adjust display scale (default is 4x)
23-
openmv --port /dev/ttyACM0 --scale 2
23+
openmv --port /dev/ttyACM0 --scale 5
2424

2525
# Run throughput benchmark
2626
openmv --port /dev/ttyACM0 --bench
@@ -47,6 +47,7 @@ openmv --port /dev/ttyACM0 --channel ticks
4747
| `--scale N` | 4 | Display scaling factor |
4848
| `--poll MS` | 4 | Poll rate in milliseconds |
4949
| `--bench` | False | Run throughput benchmark mode |
50+
| `--raw` | False | Enable raw streaming mode |
5051
| `--timeout SEC` | 1.0 | Protocol timeout in seconds |
5152
| `--baudrate N` | 921600 | Serial baudrate |
5253
| `--firmware FILE` | None | Firmware ELF file for profiler symbol resolution |
@@ -101,7 +102,7 @@ with Camera('/dev/ttyACM0') as camera:
101102

102103
# Execute script and enable streaming
103104
camera.exec(script)
104-
camera.streaming(True, raw=False, res=(512, 512))
105+
camera.streaming(True)
105106

106107
# Read frames and output
107108
while True:
@@ -152,9 +153,7 @@ with Camera('/dev/ttyACM0') as camera:
152153
print(f"Ticks: {data.decode()}")
153154
```
154155

155-
## API Reference
156-
157-
Full API documentation: [docs/api.md](https://github.com/openmv/openmv-python/blob/master/docs/api.md)
156+
## Quick Reference
158157

159158
### Camera
160159

@@ -183,7 +182,7 @@ Camera(
183182
| `is_connected()` | Check connection status |
184183
| `exec(script)` | Execute a MicroPython script |
185184
| `stop()` | Stop the running script |
186-
| `streaming(enable, raw=False, res=None)` | Enable/disable video streaming |
185+
| `streaming(enable, raw=False, resolution=None)` | Enable/disable video streaming |
187186
| `read_frame()` | Read video frame → `{width, height, format, depth, data, raw_size}` |
188187
| `read_stdout()` | Read script output text |
189188
| `read_status()` | Poll channel status → `{channel_name: bool, ...}` |
@@ -212,6 +211,10 @@ Camera(
212211
| `ChecksumException` | CRC validation failure |
213212
| `SequenceException` | Sequence number mismatch |
214213

214+
## API documentation
215+
216+
Full API documentation: [docs/api.md](https://github.com/openmv/openmv-python/blob/master/docs/api.md)
217+
215218
## Requirements
216219

217220
- Python 3.8+

docs/api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ camera.stop()
132132

133133
## Video Streaming
134134

135-
### streaming(enable, raw=False, res=None)
135+
### streaming(enable, raw=False, resolution=None)
136136

137137
Enable or disable video streaming.
138138

139139
```python
140-
camera.streaming(True, raw=False, res=(512, 512))
140+
camera.streaming(True, raw=False, resolution=(512, 512))
141141
```
142142

143143
#### Parameters
@@ -146,7 +146,7 @@ camera.streaming(True, raw=False, res=(512, 512))
146146
|-----------|------|---------|-------------|
147147
| `enable` | bool | required | Enable or disable streaming |
148148
| `raw` | bool | False | Enable raw streaming mode |
149-
| `res` | tuple | None | Resolution tuple (width, height) for raw mode |
149+
| `resolution` | tuple | None | Resolution tuple (width, height) for raw mode |
150150

151151
---
152152

src/openmv/camera.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ def exec(self, script):
345345
self._channel_ioctl(stdin_id, ChannelIOCTL.STDIN_EXEC)
346346

347347
@retry_if_failed
348-
def streaming(self, enable, raw=False, res=None):
348+
def streaming(self, enable, raw=False, resolution=None):
349349
"""Enable or disable streaming"""
350350
stream_id = self.get_channel(name="stream")
351351
if raw:
352-
self._channel_ioctl(stream_id, ChannelIOCTL.STREAM_RAW_CFG, 'II', *res)
352+
self._channel_ioctl(stream_id, ChannelIOCTL.STREAM_RAW_CFG, 'II', *resolution)
353353
self._channel_ioctl(stream_id, ChannelIOCTL.STREAM_RAW_CTRL, 'I', raw)
354354
self._channel_ioctl(stream_id, ChannelIOCTL.STREAM_CTRL, 'I', enable)
355355

src/openmv/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def main():
241241

242242
# Execute script
243243
camera.exec(script)
244-
camera.streaming(True, raw=False, res=(512, 512))
244+
camera.streaming(True, raw=False, resolution=(512, 512))
245245
logging.info("Script executed, starting display...")
246246

247247
while True:

0 commit comments

Comments
 (0)