def __init__(self): rospy.init_node('viewer', anonymous=True) image_topic = rospy.get_param('~image', '/ueye/image') # Pattern parameters pattern_rows = rospy.get_param('~pattern_rows', 7) pattern_cols = rospy.get_param('~pattern_cols', 8) pattern_size = rospy.get_param('~pattern_size', 10) config_file = rospy.get_param('~config', 'profile3d.yaml') rospy.Subscriber(image_topic, Image, self.callback, queue_size=10) rospy.on_shutdown(self.on_shutdown_hook) self.counter = 0 self.bridge = CvBridge() self.listener = tf.TransformListener() self.square_size = pattern_size self.grid_size = (pattern_cols - 1, pattern_rows - 1) self.laser_profile = Profile(axis=1, thr=180, method='pcog') self.camera_calibration = CameraCalibration( grid_size=self.grid_size, square_size=self.square_size) cv2.namedWindow('viewer') cv2.cv.SetMouseCallback('viewer', self.on_mouse, '') rospy.spin()
def __init__(self): rospy.init_node('pub_profile3d', anonymous=True) image_topic = rospy.get_param('~image', '/camera/image') cloud_topic = rospy.get_param('~cloud', '/camera/cloud') config_file = rospy.get_param('~config', 'profile3d.yaml') #peaks_topic = rospy.get_param('~peaks', '/camera/peaks') #self.image_pub = rospy.Publisher(peaks_topic, Image, queue_size=10) rospy.Subscriber(image_topic, Image, self.sub_image_topic, queue_size=1) self.sequence = 0 self.bridge = CvBridge() self.pcloud = PointCloud2() self.cloud_pub = rospy.Publisher(cloud_topic, PointCloud2, queue_size=10) self.profile = Profile() self.profile.load_configuration(config_file) rospy.spin()
np.set_printoptions(precision=4, suppress=True) path = '../' pattern_rows = 7 pattern_cols = 8 pattern_size = 0.010 config_file = 'profile3d.yaml' dirname = '../data' images, tool_poses = read_calibration_data(dirname) square_size = pattern_size grid_size = (pattern_cols - 1, pattern_rows - 1) laser_profile = Profile(axis=1, thr=180, method='pcog') camera_calibration = CameraCalibration(grid_size=grid_size, square_size=square_size) laser_calibration = LaserCalibration(grid_size=grid_size, square_size=square_size, profile=laser_profile) laser_calibration.find_calibration_3d(images) laser_calibration.save_parameters(os.path.join(path, 'config', config_file)) filenames = sorted(glob.glob('../data/pose*.txt')) ks = [int(filename[-8:-4]) for filename in filenames] poses_checker, poses_tool = [], [] poses_ichecker, poses_itool = [], [] for k in ks: print 'Frame: %i' % k img = read_image('../data/frame%04i.png' % k)
def __init__(self, grid_size=(7, 6), square_size=10.0, profile=Profile()): CameraCalibration.__init__(self, grid_size=grid_size, square_size=square_size) self.camera_pose = (np.eye(3), np.zeros(3)) self.profile = profile