--- url: "https://ai.google.dev/gemini-api/docs/robotics-spatial" titulek: "Spatial reasoning | Gemini API | Google AI for Developers" h1: "Spatial reasoning" popis: "Use Gemini Robotics ER for spatial reasoning tasks including object detection, tracking, and trajectory planning." jazyk: "en" kanonicka: "https://ai.google.dev/gemini-api/docs/robotics-spatial" drobecky: ["Gemini API", "Spatial reasoning"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 06:17:04" znaku: 9005 slov: 1296 kodovani: "iso-8859-2" sha256: "77d42b2b6f2bf3a10c21be22d8d6ce4205d1606dd6274d6da7ea0c2ffb71caf3" --- Spatial reasoning Gemini Robotics ER models can point to objects, track them in video, detect them with bounding boxes, and generate movement trajectories. For full runnable code, see the [Robotics cookbook](https://github.com/google-gemini/robotics-samples/blob/main/Getting%20Started/gemini_robotics_er.ipynb). Point to objects The following example finds specific objects in an image and returns their normalized `[y, x]` coordinates: Python`from google import genai PROMPT = """ Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{"point": , "label": }, ...]. The points are in [y, x] format normalized to 0-1000. """ client = genai.Client() uploaded_file = client.files.upload(file="my-image.png") image_response = client.interactions.create( model="gemini-robotics-er-2-preview", input=[ { "type": "image", "uri": uploaded_file.uri, "mime_type": uploaded_file.mime_type }, {"type": "text", "text": PROMPT} ], generation_config={"thinking_level": "high"}, ) print(image_response.output_text)` REST`# First, ensure you have the image file locally. # Encode the image to base64 IMAGE_BASE64=$(base64 -w 0 my-image.png) curl -X POST \ "https://generativelanguage.googleapis.com/v1beta/interactions" \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-robotics-er-2-preview", "input": { "parts": [ { "inlineData": { "mimeType": "image/png", "data": "'"${IMAGE_BASE64}"'" } }, { "text": "Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{\"point\": [y, x], \"label\": }, ...]. The points are in [y, x] format normalized to 0-1000." } ] }, "generation_config": { "thinking_config": { "thinking_level": "high" } } }'` The output will be a JSON array containing objects, each with a `point` (normalized `[y, x]` coordinates) and a `label` identifying the object. JSON`[ {"point": [376, 508], "label": "small banana"}, {"point": [287, 609], "label": "larger banana"}, {"point": [223, 303], "label": "pink starfruit"}, {"point": [435, 172], "label": "paper bag"}, {"point": [270, 786], "label": "green plastic bowl"}, {"point": [488, 775], "label": "metal measuring cup"}, {"point": [673, 580], "label": "dark blue bowl"}, {"point": [471, 353], "label": "light blue bowl"}, {"point": [492, 497], "label": "bread"}, {"point": [525, 429], "label": "lime"} ]` The following image is an example of how these points can be displayed: Tracking objects in a video Gemini Robotics ER 2 can also analyze video frames to track objects over time. See [Video inputs](/gemini-api/docs/video-understanding#supported-formats) for a list of supported video formats. Python`from google import genai client = genai.Client() uploaded_file = client.files.upload(file="my-video.mp4") prompt = """ Point to the red ball in every frame where it appears. The answer should follow the json format: [{"point": [y, x], "label":