image-js
Version:
Image processing and manipulation in JavaScript
97 lines • 3.05 kB
TypeScript
import type { Image } from '../../Image.js';
import type { Point } from '../../geometry/index.js';
export interface GetAffineTransformOptions {
/**
* @default `31`
*/
centroidPatchDiameter?: number;
/**
* @default `10`
*/
bestKeypointRadius?: number;
/**
* Should only the crossckeck matches be considered.
* @default `true`
*/
crosscheck?: boolean;
/**
* Should the contrast of the images be enhanced before feature matching.
* @default `true`
*/
enhanceContrast?: boolean;
/**
* Origin of the destination image relative to the top-left corner of the source image.
* Roughly indicates the position of the destination image in the source image. Is used
* to filter matches by distance as well as to define a subarea of the source image to
* use for contrast enhancement.
* @default `{ column: 0, row: 0 }`
*/
destinationOrigin?: Point;
/**
* Max number of iterations of the ransac algorithm.
*/
maxRansacNbIterations?: number;
/**
* Save images with matches for debugging.
* @default `false`
*/
debug?: boolean;
/**
* Path of the debug image.
* @default `${import.meta.dirname}/montage.png`
*/
debugImagePath?: string;
}
export interface AffineTransform {
/**
* Translation of source points along x and y axes.
*/
translation: Point;
/**
* Clockwise angle in degrees.
*/
rotation: number;
/**
* Scaling factor from source to destination.
*/
scale: number;
}
export interface GetAffineTransformResult {
/**
* Affine transformation from source to destination.
*/
transform: AffineTransform;
stats: {
/**
* Number of matches of feature matching between source and destination.
* The bigger this number is, the better.
*/
nbMatches: number;
/**
* Number of inliers resulting from the ransac algorithm.
*/
nbInliers: number;
/**
* Number of iterations of the RANSAC algorithm.
*/
nbRansacIterations: number;
/**
* Number of source keypoints used for matching.
*/
nbSourceKeypoints: number;
/**
* Number of destination keypoints used for matching.
*/
nbDestinationKeypoints: number;
};
}
/**
* Get the affine transformation from the source to the destination image.
* @param source - Source image. Should be the image to align on the reference image.
* It can have an additional margin, specified in the options.
* @param destination - Destination image. Should be the reference image.
* @param options - Get destination translation options.
* @returns The affine transformation from source to destination image.
*/
export declare function getAffineTransform(source: Image, destination: Image, options?: GetAffineTransformOptions): GetAffineTransformResult;
//# sourceMappingURL=getAffineTransform.d.ts.map