Skip to content

Commit 5b4d8e2

Browse files
authored
DOCS-3284: Add simpler get_image example (#844)
1 parent 787c605 commit 5b4d8e2

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/viam/components/camera/camera.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,9 @@ async def get_image(
4848
4949
::
5050
51-
from viam.media.video import CameraMimeType
52-
53-
my_camera = Camera.from_robot(robot=machine, name="my_camera")
54-
55-
# Assume "frame" has a mime_type of "image/vnd.viam.dep"
56-
frame = await my_camera.get_image(mime_type = CameraMimeType.VIAM_RAW_DEPTH)
57-
58-
# Convert "frame" to a standard 2D image representation.
59-
# Remove the 1st 3x8 bytes and reshape the raw bytes to List[List[Int]].
60-
standard_frame = frame.bytes_to_depth_array()
51+
my_camera = Camera.from_robot(machine, "my_camera")
52+
frame = await my_camera.get_image()
53+
print(f"Frame: {frame}")
6154
6255
Args:
6356
mime_type (str): The desired mime type of the image. This does not guarantee output type

0 commit comments

Comments
 (0)