NAME
Games::Go::Image2SGF -- interpret photographs of go positions.
SYNOPSIS
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};
DESCRIPTION
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
Options are passed to Games::Go::ImageSGF via its constructor. It will attempt to use sane defaults for options you don't supply; arguments must be supplied for the required options.
- 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.
- 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 generated SGF is incorrect. Default: Black is[0,0,0]
, white is[255,255,255]
, board colour is[100,100,100]
. - image
-
Required. The filename of the image to interpret. This can be in any format supported by Imager.
- sample_radius
-
Optional. After inferring the grid from the corner points you give, the module will search in a radius of
sample_radius
pixels to look for stones of a particular colour. As with thewhite, black, board
options: the default is likely to do the right thing, and you should only increase or decrease it if your image is very large or very small. Default: 10 pixels.
NOTES
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.
DEPENDENCIES
Imager
, perl5
.
SEE ALSO
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/.
AUTHOR
Chris Ball <chris@cpan.org>
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 6:
=cut found outside a pod block. Skipping to next block.