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' ); $board->to_sgf; 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.
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.
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].
[255,255,255]
[0,0,0]
[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.
sample_radius
white, black, board
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.
Imager
perl5
Further examples at http://www.inference.phy.cam.ac.uk/cjb/image2sgf.html, the http://www.red-bean.com/sgf/ SGF standard, and the collaborative guide to Go at http://senseis.xmp.net/.
Chris Ball <chris@cpan.org>
1 POD Error
The following errors were encountered while parsing the POD:
=cut found outside a pod block. Skipping to next block.
To install Games::Go::Image2SGF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Go::Image2SGF
CPAN shell
perl -MCPAN -e shell install Games::Go::Image2SGF
For more information on module installation, please visit the detailed CPAN module installation guide.