Skip to content
UsecaseBoard
← All use cases
devtoComputer Vision

Mark green objects in a photo with generated vision code

At a glance

A developer uses Gemini's code execution to draw bounding boxes around green LEGO bricks in an uploaded image. This workflow is listed under Computer Vision, Image Annotation, Code Execution.

SourceBuilding a tool for these workflows? See weekly rates.

What they did

1) Open Google AI Studio with access to Gemini 3.0 Flash, enable High thinking and Code Execution, and prepare a photo containing colored LEGO bricks. 2) Upload the image and request bounding boxes around the green bricks, with the annotated image displayed. 3) Let Gemini generate and execute the processing code. In the demonstrated run, it converted the image to HSV, selected a green range of [35, 50, 50] to [85, 255, 255], found external contours, and ignored areas of 1,000 pixels or less. 4) Inspect the displayed boxes against the green objects. The generated script saves the annotated result as green_bricks_detected.png; download that output when the marked objects match the intended selection.

How it went

The author shows the annotated LEGO result and reports an approximate cost of $0.006 for that detection run.

Worth knowing

The demonstrated color range and area cutoff belong to this image; they are not evidence of a general object detector's accuracy.

Save ideas in this browser. Upvotes count across the board.

Prompt excerpt

Draw bounding boxes around the green LEGO bricks. Display the image with bounding boxes.

Sponsored

CodeBuddy

Tencent Cloud AI coding assistant for IDE and CLI.

Try CodeBuddy ↗
Explore all →

No related workflows yet. Explore the directory for more ideas.