import { type BitImage } from './binarise.js';
export interface Point {
    readonly x: number;
    readonly y: number;
}
export interface Finder extends Point {
    readonly moduleSize: number;
    readonly count: number;
}
/** Where a symbol sits in the picture, and how to sample it. */
export interface Location {
    readonly topLeft: Point;
    readonly topRight: Point;
    readonly bottomLeft: Point;
    readonly alignment: Point | undefined;
    readonly size: number;
    /** Picture coordinates of the centre of module (x, y). */
    readonly project: (x: number, y: number) => Point;
    /**
     * The nine numbers of the projective map `project` applies to
     * (x + 0.5, y + 0.5), row by row, when it is that map and nothing more.
     */
    readonly matrix?: readonly number[] | undefined;
}
/**
 * Work the search does, counted for tests that bound it: pixels stepped in
 * cross-checks, stored candidates compared while merging, pixels in the
 * windows searched for alignment patterns, maps sampled, maps read again
 * by the second look, those of them read through a mesh, and the points the
 * mesh probed looking for alignment patterns; and, when counted, the maps
 * sampled at reduced size.
 */
export interface Work {
    steps: number;
    compared: number;
    scanned: number;
    maps: number;
    second: number;
    meshes: number;
    probed: number;
    reduced?: number;
}
/**
 * Where each row of a black-and-white picture changes colour: for row y,
 * every x from 1 up at which the pixel differs from the one before it, in
 * order. Each row is worked out when first asked for and kept. A picture and
 * its inverse change colour at the same places, so they share one of these.
 */
export interface Edges {
    readonly row: (y: number) => Int32Array;
}
export declare function edgesOf(image: BitImage): Edges;
/**
 * Finds finder pattern candidates, most often confirmed first. `tolerance`
 * is how far a run may stray from its share, in modules; a blurred light
 * ring needs more than the default half module.
 */
export declare function findFinders(image: BitImage, tolerance?: number, work?: Work, edges?: Edges): Finder[];
/**
 * Every plausible top-left, top-right, bottom-left triple, best first. The
 * two sides meeting at the top-left should be the same number of modules
 * long, counted along each side, and meet near a right angle. Perspective
 * shrinks modules towards the far edge, so lengths in pixels can differ
 * widely; lengths in modules do not.
 */
export declare function finderTriples(image: BitImage, finders: readonly Finder[]): [Finder, Finder, Finder][];
/** The symbol's size in modules from its finders' spacing, rounded to 1 (mod 4); undefined when the modules are under a pixel. */
export declare function estimateSize(image: BitImage, triple: readonly [Finder, Finder, Finder]): number | undefined;
/**
 * Turns three finders into sampling maps: one through each likely alignment
 * pattern (when the version has one), then one through the fourth corner.
 * `sizeHint` overrides the estimated module count.
 */
export declare function locate(image: BitImage, triple: readonly [Finder, Finder, Finder], sizeHint?: number, work?: Work, edges?: Edges): Location[];
/** The original corner maps, without alignment searches. */
export declare function locateCorners(image: BitImage, triple: readonly [Finder, Finder, Finder], sizeHint?: number, edges?: Edges): Location[];
