View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Chris Ball > Games-Go-Image2SGF > Games::Go::Image2SGF



Annotate this POD

View/Report Bugs
Module Version: 1.03   Source  


Games::Go::Image2SGF -- interpret photographs of go positions.


   my $board = Games::Go::Image2SGF->new(
       tl         => [50,   50],
       tr         => [1000, 50],
       bl         => [50,   1000],
       br         => [1000, 1000],
       image      => 'go_photograph.jpg'

   print $board->{sgf};


Games::Go::Image2SGF is a perl5 module to create a computer-readable SGF format description of the position on a Go board, given a photograph of the position.


Options are passed to Games::Go::ImageSGF via its constructor. It will attempt to use sane defaults for arguments you don't supply; you must supply values for the required arguments.

tl, tr, bl, br

Required. The coordinates of the four corners of the go board's grid. You can obtain these by loading your photograph in an image editor that displays image coordinates and hovering the cursor over each of the grid corners.


Required. The filename of the image to interpret. This can be in any format supported by Imager.

white, black, board

Optional. A fairly-representative colour for the white stones, black stones, and go board itself, presented in decimal RGB triplets -- eg. [255,255,255] for white. You should only set these if the defaults are generating incorrect SGF. Default: Black is [0,0,0], white is [255,255,255], board colour is [100,100,100].


Optional. After inferring the grid from the corner points you give, the module will search in a radius of sample_radius pixels to look at the area's colour. As with the white, black, board arguments, the default is likely to do the right thing; you should only need to change this if your image is very large or very small. Default: 10 pixels.


You may want to use the methods defined in the module in another order, or in conjunction with other methods of your own -- for example, to track video of a live game instead of still images. Note that methods with a leading _ are considered internal, and their semantics may change.


Imager, perl5.


Further examples at, the SGF standard, and the collaborative guide to Go at


Chris Ball <>

syntax highlighting: