identify_trap_locations(image, trap_template, optimize_scale=True, downscale=0.35, trap_size=None)[source]

Identify the traps in a single image based on a trap template.

Requires the trap template to be similar to the image (same camera, same magnification - ideally the same experiment).

Use normalised correlation in scikit-image’s to match_template.

The search is sped up by down-scaling both the image and the trap template before running the template matching.

The trap template is rotated and re-scaled to improve matching. The parameters of the rotation and re-scaling are optimised, although over restricted ranges.

image: 2D array
trap_template: 2D array
optimize_scaleboolean (optional)
downscale: float (optional)

Fraction by which to downscale to increase speed

trap_size: integer (optional)

If unspecified, the size is determined from the trap_template

coordinates: an array of pairs of integers