Exemplo n.º 1
0
def stereo_calibrate_detections(detections, board, cameras, i, j, **kwargs):
    matching = [
        intersect_detections(board, d1, d2)
        for d1, d2 in zip(detections[i], detections[j])
    ]

    matching_frames = transpose_structs(filter_none(matching))
    return stereo_calibrate((cameras[i], cameras[j]), matching_frames,
                            **kwargs)
Exemplo n.º 2
0
def board_correspondences(board, detections):
  non_empty = [d for d in detections if board.has_min_detections(d)]
  if len(non_empty) == 0:
    return struct(corners = [], object_points=[], ids=[])

  detections = transpose_structs(non_empty)
  return detections._extend(
      object_points=[board.points[ids].astype(np.float32) for ids in detections.ids],
      corners=[corners.astype(np.float32) for corners in detections.corners]
  )
Exemplo n.º 3
0
def matching_points(points, board, cam1, cam2):
    points1, points2 = points._index[cam1], points._index[cam2]
    matching = []

    for i, j in zip(points1._sequence(0), points2._sequence(0)):
        row1, row2, ids = common_entries(i, j)
        matching.append(
            struct(points1=row1.points,
                   points2=row2.points,
                   object_points=board.points[ids],
                   ids=ids))

    return transpose_structs(matching)