aliby.tile.traps.identify_trap_locations¶
- 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, which requires the trap template to be similar to the image (same camera, same magification - ideally the same experiment).
Uses normalised correlation in scikit-image’s match_template.
The search is speeded up by downscaling 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 rescaling are optimised, although over restricted ranges.
- Parameters
- 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
- Returns
- coordinates: an array of pairs of integers