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
Copy file name to clipboardExpand all lines: src/arduino/app_peripherals/camera/README.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,34 @@ with Camera(source, **options) as camera:
41
41
# Camera automatically stopped when exiting
42
42
```
43
43
44
+
## Frame Adjustments
45
+
46
+
The `adjustments` parameter allows you to apply custom transformations to captured frames. This parameter accepts a callable that takes a numpy array (the frame) and returns a modified numpy array. It's also possible to build adjustment pipelines by concatenating these functions with the pipe (|) operator
47
+
48
+
```python
49
+
import cv2
50
+
from arduino.app_peripherals.camera import Camera
51
+
from arduino.app_utils.image import greyscaled
52
+
53
+
54
+
defblurred():
55
+
defapply_blur(frame):
56
+
return cv2.GaussianBlur(frame, (15, 15), 0)
57
+
return PipeableFunction(apply_blur)
58
+
59
+
# Using adjustments with Camera
60
+
with Camera(0, adjustments=greyscaled) as camera:
61
+
frame = camera.capture()
62
+
# frame is now grayscale
63
+
64
+
# Or with multiple transformations
65
+
with Camera(0, adjustments=greyscaled | blurred) as camera:
66
+
frame = camera.capture()
67
+
# frame is now greyscaled and blurred
68
+
```
69
+
70
+
See the arduino.app_utils.image module for more supported adjustments.
71
+
44
72
## Camera Types
45
73
The Camera class provides automatic camera type detection based on the format of its source argument. keyword arguments will be propagated to the underlying implementation.
0 commit comments