20 lines
868 B
Python
20 lines
868 B
Python
|
import helpers
|
||
|
import numpy as np
|
||
|
import pickle
|
||
|
|
||
|
screenDrawCorners = np.array([[10,60], [90, 60], [10, 110], [90, 110]])
|
||
|
coordinates = pickle.load(open("coordinates.p", "rb"))
|
||
|
print("Loaded coordinates: %s", helpers.coordinatesToSrc(coordinates))
|
||
|
print("Corners: %s", screenDrawCorners)
|
||
|
|
||
|
transform = helpers.create_perspective_transform(helpers.coordinatesToSrc(coordinates), screenDrawCorners)
|
||
|
|
||
|
a = [np.array([ 1312.15541183]), np.array([ 244.56278002])]
|
||
|
midpointTop = (coordinates['tr'] - coordinates['tl'])/2 + coordinates['tl']
|
||
|
midpointCenter = (coordinates['tr'] - coordinates['bl'])/2 + coordinates['bl']
|
||
|
print("Test point %s", a)
|
||
|
print("Transformed point %s", transform(a))
|
||
|
print("Test point %s", midpointTop )
|
||
|
print("Transformed point %s", transform(midpointTop))
|
||
|
print("Test point %s", midpointCenter )
|
||
|
print("Transformed point %s", transform(midpointCenter))
|