Skip to content

Matcher

Matcher(img1, img2, stats=False)

Tool to find matching points between a pair of images

Parameters:

Name Type Description Default
img1 Image

The first image to study

required
img2 Image

The other image to study

required
stats bool

Whether refine should return statistics

False

refine(p1, p2, size, iters=1, tolerance=0)

Iteratively refine a pair of matching points

Parameters:

Name Type Description Default
p1 ArrayLike

point in img1 that putatively matches...

required
p2 ArrayLike

... this point in img2

required
size ArrayLike

size of window to grab around the points

required
iters int

number of iterations to perform

1
tolerance float

if positive, stop early if absolute shift less than this

0

Returns:

Name Type Description
p1 ArrayLike

updated point in first image

p2 ArrayLike

updated point in second image

stats RefinementStats

optional statistics about refinement

The returned p1 and p2 are better estimates of the matching points in the two images.

If size is a single number, a square window is used. Otherwise, size must comprise a (width, height)-pair.

Up to iters iterations are performed. If at any time the Euclidean length of the refinement is less than tolerance, the process is ended early.

The returned stats may be used as an indicator of the quality of the results. See RefinementStats, below. Stats are only returned if enabled at construction time.

RefinementStats()

The statistics returned from a refine call

In general, a large shift (compared to the size of the window) is indicative of lack of convergence.

A low snr value (relative to results from comparable images) is also indicative of a poor match.

Uncommonly high peakwidth is also a bad sign, but a respectable peakwidth on its own should not be taken as proof that the match is OK.

Attributes:

Name Type Description
dist float

Euclidean length of shift found in final iteration

dists List[float]

Euclidean lengths of shifts found in each iteration

niters int

The number of iterations performed

peakwidth ArrayLike

(sx, sy)-pair of the size of the spectral peaks found in final iteration

peakwidths List[ArrayLike]

(sx, sy)-pairs of the size of the spectral peaks found in each iteration

shift ArrayLike

(x, y)-pair of shift found in final iteration

shifts List[ArrayLike]

(x, y)-pairs of shifts in each iteration

snr float

Signal-to-noise ratio found in final iteration

snrs List[float]

Signal-to-noise ratios found in each iteration

totaldist float

Euclidean length of total shift across all iterations

dist

Euclidean length of shift found in final iteration

dists

Euclidean lengths of shifts found in each iteration

niters

The number of iterations performed

peakwidth

(sx, sy)-pair of the size of the spectral peaks found in final iteration

peakwidths = []

(sx, sy)-pairs of the size of the spectral peaks found in each iteration

shift

(x, y)-pair of shift found in final iteration

shifts = []

(x, y)-pairs of shifts in each iteration

snr

Signal-to-noise ratio found in final iteration

snrs = []

Signal-to-noise ratios found in each iteration

totaldist

Euclidean length of total shift across all iterations