Skip to content

Commit f8cd19f

Browse files
Mention the 'frame' argument to the vision API
Based on a previous patch which Dan put together, updated and with some fixes applied. Co-Authored-By: Dan Trickey <[email protected]>
1 parent c14379b commit f8cd19f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

programming/sr/cheat_sheet.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,22 @@ for marker in markers:
191191
marker.orientation.rotation_matrix
192192
~~~~~
193193

194+
## Getting the frame from the camera
195+
196+
It is also possible to get an OpenCV frame from the camera:
197+
198+
~~~~~ python
199+
frame = R.camera.capture()
200+
~~~~~
201+
202+
You can use this frame in your own vision processing, or use it with other vision commands.
203+
204+
~~~~~ python
205+
markers = R.camera.see(frame=frame)
206+
marker_ids = R.camera.see_ids(frame=frame)
207+
R.camera.save('photo.jpg', frame=frame)
208+
~~~~~
209+
194210
## Ruggeduino
195211

196212
### Setting the mode of a pin

programming/sr/vision/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ frame = R.camera.capture()
8585
flipped = cv2.flip(frame, 0)
8686
~~~~~
8787

88+
You can also use a frame with other vision commands to avoid recapturing. This may be useful if you wish to use both your own vision algorithms and our vision on the same frames.
89+
90+
~~~~~ python
91+
markers = R.camera.see(frame=frame)
92+
marker_ids = R.camera.see_ids(frame=frame)
93+
R.camera.save('photo.jpg', frame=frame)
94+
~~~~~
95+
8896
[Field of View](#fov) {#fov}
8997
-------------------
9098

0 commit comments

Comments
 (0)