Changed the solvePnP direction. Now 3d points are computed from the template image