Kifu: Go game record (kifu) generator
Image change detection:
Using vertical RGB components sums of a thresholded difference between a reference image and the current one, it is easy to compute the screen coordinates of a played stone
Geometric projection:
It is necessary to map a point from the screen to a point of the goban rectangle, the corners screen coordinates, and the target rectangle proportions being known.
And for this, to compute a 3x3 transformation matrix to map any point of the displayed quadrilateral shape to a rectangular shape.
Then you can compute proportionally the grid coordinates using the mapped coordinates.
To compute the tranformation matrix, there is this untested formulae:
(Maybe somebody could confirm it's worth writing code for H=X'Xt(XXt)^-1 ... :)
X: screen projection coordinates
X': goban corners coordinates
X=[x1 x2 x3 x4; y1 ... y4; 1 ... 1]
X'=[x1' x2' x3' x4'; y1' ... y4'; 1 ... 1]
H=X'Xt(XXt)^-1 (with Xt = transposed matrix of X)
p'=Hp
p'=[a;b;c]
x=a/c
y=b/c
Links:
http://www.sourceforge.net/projects/kifu
http://sciences.ch/htmlfr/geometrie/geometrieanalytique01.php#eqcartplan
http://sciences.ch/htmlfr/geometrie/geometrieprojective01.php