Skip to content

Commit

Permalink
handle duplicate peak values
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Johnson committed Nov 18, 2024
1 parent 59a694d commit 9b1a613
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/vsi/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def find_template_offset(template: np.floating, image: np.floating,
fit = xc.max()
y_peak, x_peak = np.nonzero(xc == fit)

# if there are duplicate peak values, take the first
y_peak = y_peak[0]
x_peak = x_peak[0]

y_offset = y_peak[0] - template.shape[0] + 1
x_offset = x_peak[0] - template.shape[1] + 1

Expand Down

0 comments on commit 9b1a613

Please sign in to comment.