Dataset image
Loading
Pipeline
- Edges and board outline. The image is downscaled, converted to luminance, and passed through Sobel gradients. Strong edges are dilated; the largest plausible rectangular component proposes the board outline.
- Perspective normalization. Four corners define a homography from unit-square board coordinates to image pixels. Every square sample is pulled through that transform, so oblique boards become a square 8x8 grid.
- Square occupancy. Each square is sampled in its interior. Center-versus-ring contrast, local variance, and tiny gradient energy are combined into an occupancy score.
- Readout. Adaptive thresholding splits empty and occupied squares. Occupied squares are labeled P or p by relative luminance, then packed into a FEN-like board string.
for each candidate photo:
gray = luminance(image)
edges = sobel(gray) > percentile(74)
board = largest_dilated_component(edges)
H = homography(unit_square, board_corners)
for each square:
score = center_delta + variance + edge_energy
threshold = robust_gap_or_otsu(scores)
fen = pack_8x8(occupied)
Evaluation loop
Dataset run
The final heuristic came from three passes over the dataset: first a pure edge component detector, then a homography rectifier, then a more conservative occupancy threshold after close-up images over-fired on board texture.
| Image | View | Board | Occupancy | Notes |
|---|
Failure modes
Very low board height. Side-on boards collapse several ranks into only a few pixels. The corner homography still lands, but individual pieces shadow multiple squares.
Close-up partial boards. Images that do not contain all four board corners are treated as visual demos, not exact board extraction. The uploaded-photo path reports lower confidence in this case.
Piece type limits. This submission scores occupancy only. Full piece recognition would need a local classifier trained on rectified square crops and included with the page.