Exemple #1
0
    ax0.axes.set_xlim(ax1.axes.get_xlim())
    y_min, y_max = ax1.axes.get_ylim()
    ax0.axes.set_ylim((-y_min, -y_max))

  # Find the center.
  try:
    piece.find_center()
    if args['--plot']:
      ax1.plot(piece.center[0], piece.center[1], '*b', markersize=8)
    piece_data['center'] = piece.center
  except:
    print 'could not find center for "%s"' % filepath

  # Find corner candidates with template matching.
  try:
    piece.template_corners()
    if args['--plot']:
      for cc in piece.candidate_corners:
        ax1.plot(cc[0], cc[1], '+r', markersize=8)
  except:
    print 'could not find corner candidates for "%s"' % filepath

  # Find the "true corners."
  try:
    piece.find_true_corners()
    if args['--plot']:
      corner_xs = [c[0] for c in piece.corners]
      corner_ys = [c[1] for c in piece.corners]
      ax1.plot(corner_xs, corner_ys, 'og', markersize=8)
    piece_data['corners'] = [c.tolist() for c in piece.corners]
  except: