drone-rigide/python/test_find_targets.py
2019-02-15 15:49:30 +01:00

19 lines
484 B
Python

import matplotlib.pyplot as pl
from matplotlib.patches import Rectangle
from find_targets import find_targets
fig, ax = pl.subplots(1)
img = pl.imread('image.jpeg')
H, L, R, objects = find_targets(img, return_slices=True)
for o in objects:
x, y = o
r = Rectangle((y.start, x.start), y.stop-y.start, x.stop-x.start, linewidth=1,edgecolor='r',facecolor='none')
ax.add_patch(r)
ax.imshow(img)
ax.plot([H[1], L[1], R[1]], [H[0], L[0], R[0]], 'o', color='red')
pl.show()