Modules

imago

Go image recognition.

imago.main()[source]

Main function of the program.

hough

Hough transform module.

class hough.Hough(size, dt, init_angle)[source]

Hough transform.

This class stores the parameters of the transformation.

angle_distance(point)[source]

Take a point from the transformed image and return the corresponding line in the original as (angle, distance) tuple.

classmethod default(image)[source]

Default parameters for Hough transform of the image.

lines_from_list(p_list)[source]

Take a list of transformed points and return a list of corresponding lines as (angle, distance) tuples.

ransac.py

RANSAC estimation.

class ransac.Linear_model(data)[source]

Linear model for RANSAC.

ransac.estimate(data, dist, k, modelClass=<class ransac.Linear_model at 0x38f3870>, model=None)[source]

Estimate model from data with RANSAC.

ransac.filter_near(data, line, distance)[source]

Find points in data that are closer than distance to line.

ransac.least_squares(data)[source]

The least squares method.

ransac.points_to_line((x1, y1), (x2, y2))[source]

Take two points, return coefficitiens for line that connects them.

geometry

Imago geometry module.

class geometry.V(x, y)[source]

Class for vector manipulation.

geometry.intersection(p, q)[source]

Return intersection of two lines.

geometry.l2ad((a, b), size)[source]

Represent line as (angle, distance).

Take a line (represented by two points) and image size. Return the line represented by its angle and distance from the center of the image.

geometry.line(x, y)[source]

Return parametric representation of line.

filters

Image filters module.

All filters return a filtered copy of the image, the original image is preserved.

filters.color_enhance(image)[source]

Stretch all color channels to their full range.

filters.components(image, diameter)[source]

Reduce each conected component to one point.

filters.edge_detection(image)[source]

Edge detection (on BW images).

filters.high_pass(image, height)[source]

High pass filter (on BW images).

filters.peaks(image)[source]

Peak filter (on BW images).

linef

Lines finding module.

linef.find_lines(image, show_image, logger)[source]

Find lines in the image.

linef.line_from_angl_dist((angle, distance), size)[source]

Take angle and distance (from the center of the image) of a line and size of the image. Return the line represented by two points.

linef.prepare(image, show_image, logger)[source]

Return preproccessed image.

linef.run_ransac(image)[source]

Run RANSAC on the image.

linef.transform(image, hough, show_image)[source]

Return Hough transform of the image.

gridf_new

Imago grid fitting module

RANSAC inspired method.

class gridf_new.Diagonal_model(data)[source]

Ransac model for finding diagonals.

class gridf_new.Line((a, b, c))[source]

Line with a list of important points that lie on it.

This and the Point class in this module serves to implement a model of perspective plain – a line has a list of intersections with other lines and each intersection has two lines that go through it.

class gridf_new.Point((x, y))[source]

Class that represents a point in 2D.

gridf_new.dst(p, l)[source]

Distance from a point to a line.

gridf_new.find(lines, size, l1, l2, bounds, hough, show_all, do_something, logger)[source]

Find the best grid given the lines and size of the image.

Last three parameters serves for debugging, l1, l2, bounds and hough are here for compatibility with older version of gridf, so they can be easily exchanged, tested and compared.

gridf_new.gen_corners(d1, d2, min_size)[source]

Generate candidates on corner positions from the diagonals.

gridf_new.intersection((a1, b1, c1), (a2, b2, c2))[source]

Intersection of two lines, given by coefficients in their equations.

gridf_new.plot_line(line, c, size)[source]

Plot a line with pyplot.

gridf_new.score(lines, points)[source]

Score the candidate for a grid.

intrsc

Imago intersections module.

intrsc.b_intersects(image, lines, show_all, do_something, logger)[source]

Compute intersections.

intrsc.board(image, intersections, show_all, do_something, logger)[source]

Find stone colors and return board situation.

intrsc.dst(line)[source]

Return normalized line.

intrsc.dst_sort(lines)[source]

Return lines sorted by distance.

intrsc.intersections_from_angl_dist(lines, size, get_all=True)[source]

Take grid-lines and size of the image. Return intersections.

intrsc.mean_luma(cluster)[source]

Return mean luminanace of the cluster of points.

intrsc.rgb2lumsat(color)[source]

Convert RGB to luminance and HSI model saturation.

intrsc.stone_color_raw(image, (x, y))[source]

Given image and coordinates, return stone color.

intrsc.to_general(line, size)[source]

Convert line from (angle, distance) to (a, b, c).

k_means

K-means module.

k_means.centroid(cluster)[source]

Find the centroid of the cluster.

k_means.cluster(k, d, data, i_centers=None)[source]

Find k clusters on d dimensional data.

k_means.delta(c1, c2)[source]

Find the absolute distance between two lists of points.

k_means.nearest(centers, point)[source]

Find the nearest cluster center for point.

k_means.next_step(centers, data)[source]

Compute new clusters and centers.

manual

Manual grid selection module

manual.find_lines(im_orig)[source]

Run the GUI.

output

Imago output module.

class output.Board(size, stones)[source]

Represents the state of the board.

addMove(m)[source]

Add move to the board.

asSGFsetPos()[source]

Returns SGF (set position) representation of the position.

getMoveCandidates(board)[source]

Take the next board in game and return a list of moves that are new.

class output.Game(size, board=None, debug=True)[source]

Represents a game.

addMove(board)[source]

Add next move to the game.

asSGF()[source]

Return the game representation as SGF string.

class output.Move(color, y, x, comment=None)[source]

Repsresents a move.

sgf_coords()[source]

Return coordinates of the move in SGF.

im_debug

Debugging image display.

This is a simple module that shows images on screen using PyGame. It is not used anywhere in the standard UI, serves only for debugging.

im_debug.show(image, caption='', name=None)[source]

Initialize PyGame and show the image.

camera

Camera module.

This module handles various backends (different for every OS) for streaming the video from a (web)camera.

class camera.Camera(vid=0, res=None)[source]

Implement basic camera capabilities

This class has different implementations for different OS. On posix systems it calls to opencv, on Windows to VideoCapture.

get_image()[source]

Get a new image from the camera.

capture

Go image capture.

This module defines a UI for capturing images with a (web)camera and imediately proccessing them with Imago.

class capture.Capture(device, res)[source]

This object maintains communication between the camera, the PyGame screen and Imago.

auto(interval)[source]

Take new image every interval seconds.

live(q)[source]

Run live preview on the screen.

manual()[source]

Take images manualy by pressing a key.

take()[source]

Take a new image from the camera.

class capture.Screen(res)[source]

Basic PyGame setup.

display_picture(im)[source]

Display image on PyGame screen.

capture.main()[source]

Parse the argument and setup the UI.

timer

Go timer.

This module defines a UI that combines game clock with automatic game recording. When player presses the clock, an image of the board is taken. The sequence of images can later be analysed by Imago to produce a game record in abstract notation.

class timer.Timer(main_time, byop, byot)[source]

Keeps track of time remaining one player.

get_time()[source]

Return string representation of remaining time.

is_running()[source]

Return True if the clock is running.

start()[source]

Start the clock.

stop()[source]

Stop the clock.

timer.main()[source]

Parse the arguments and run the clock.

Table Of Contents

Previous topic

Usage

This Page