← Vibed · Reused · Tiled Example project

Tile stock · Image sampler

Tile Stock Image Sampler

by Harrison Hildebrandt

Reuse starts with knowing what is in the pile. This small Python tool takes a photo of tiles, finds every tile-shaped region, names its colour and writes one CSV row per tile. The result is a rough stock count you can feed into a tiling design.

  1. 01Cluster coloursK-means on a downscaled copy, then every full-size pixel joins its nearest cluster.
  2. 02Cut on groutCanny edges are dilated into a barrier so neighbouring tiles do not merge.
  3. 03Find regionsConnected components per colour, filtered by minimum area, size and rectangularity.
  4. 04Name and exportEach region's mean colour snaps to a small palette and is written to CSV.

Results

Hover a tile to see what was detected.
Full results table
id colour x y w h area px mean RGB

Files and how to run it

# Python 3 with OpenCV, NumPy and pandas
pip install opencv-python numpy pandas

# Writes tile_results/tile_counts.csv and prints a count per colour
python tile_counter.py source_image.jpg