From 5b4d8e2e9719fd6682035e61ccd3fffd03f2538c Mon Sep 17 00:00:00 2001 From: Sierra Guequierre Date: Wed, 12 Feb 2025 10:26:23 -0500 Subject: [PATCH] DOCS-3284: Add simpler get_image example (#844) --- src/viam/components/camera/camera.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/viam/components/camera/camera.py b/src/viam/components/camera/camera.py index 1b530f65f..9faeae9d5 100644 --- a/src/viam/components/camera/camera.py +++ b/src/viam/components/camera/camera.py @@ -48,16 +48,9 @@ async def get_image( :: - from viam.media.video import CameraMimeType - - my_camera = Camera.from_robot(robot=machine, name="my_camera") - - # Assume "frame" has a mime_type of "image/vnd.viam.dep" - frame = await my_camera.get_image(mime_type = CameraMimeType.VIAM_RAW_DEPTH) - - # Convert "frame" to a standard 2D image representation. - # Remove the 1st 3x8 bytes and reshape the raw bytes to List[List[Int]]. - standard_frame = frame.bytes_to_depth_array() + my_camera = Camera.from_robot(machine, "my_camera") + frame = await my_camera.get_image() + print(f"Frame: {frame}") Args: mime_type (str): The desired mime type of the image. This does not guarantee output type