2.5 KiB
2.5 KiB
Polygon Drawer Skill
This skill uses @tools/draw_polygon.py to draw polygons on any image. It's useful for highlighting areas, marking objects, creating masks, or annotating images with colored shapes.
Usage Examples
Draw a red box around an object
Draw a red box around the door in image.png
# Executes: python tools/draw_polygon.py tmp/annotated_image.png "0.3,0.2 0.7,0.2 0.7,0.8 0.3,0.8" --color red --save tmp/annotated_image.png
# Opens: /home/noti/dev/ai-game-2/tmp/annotated_image.png
Highlight an area in green
Highlight the pool in green using a polygon
# Executes: python tools/draw_polygon.py tmp/pool_highlight.png "0.2,0.5 0.8,0.5 0.8,0.9 0.2,0.9" --color green --fill --save tmp/pool_highlight.png
# Opens: /home/noti/dev/ai-game-2/tmp/pool_highlight.png
Draw a blue circle (approximated with polygon)
Draw a blue circle around the tree
# Executes: python tools/draw_polygon.py tmp/tree_circle.png "0.4,0.3 0.6,0.3 0.6,0.5 0.4,0.5" --color blue --save tmp/tree_circle.png
# Opens: /home/noti/dev/ai-game-2/tmp/tree_circle.png
Fill a region with semi-transparent overlay
Fill the sky area with semi-transparent yellow
# Executes: python tools/draw_polygon.py tmp/sky_overlay.png "0,0 1,0 1,0.6 0,0.6" --color yellow --fill --save tmp/sky_overlay.png
# Opens: /home/noti/dev/ai-game-2/tmp/sky_overlay.png
Mark a specific point with a small polygon
Mark the character location with a red polygon
# Executes: python tools/draw_polygon.py tmp/character_mark.png "0.5,0.4 0.52,0.38 0.54,0.4 0.52,0.42" --color red --save tmp/character_mark.png
# Opens: /home/noti/dev/ai-game-2/tmp/character_mark.png
How It Works
- Analyze the image to understand what needs highlighting
- Extract polygon coordinates based on visual patterns or user input
- Execute the draw_polygon.py script with percentage coordinates (0.0-1.0)
- Save the result to ./tmp/ and display the file path
- Open the output for you to view
Coordinate System
Coordinates use percentage mode (0.0-1.0) by default:
0.0,0.0= top-left corner1.0,1.0= bottom-right corner0.5,0.5= center of image
Common Use Cases
- Highlighting objects or regions of interest
- Creating masks for image processing
- Marking locations for documentation
- Annotating images with colored boundaries
- Visualizing spatial relationships
Output
All annotated images are saved to ./tmp/ and the full path is displayed so you can open them in your image viewer.