Exemple #1
0
 def __init__(self):
     rospy.Subscriber('/usb_cam/image_raw/compressed',
                      CompressedImage,
                      self.image_proc,
                      queue_size=1,
                      buff_size=2**24)
     self.pub = rospy.Publisher('/proc_image', Image, queue_size=1)
     self.lane_pub = rospy.Publisher('/lane_loc', Lanepoints, queue_size=1)
     self.Bridge = CvBridge()
     # camera parameters
     # rosparam.load_file('/home/aj/Desktop/barc_calibrationdata/ost.yaml')
     self.cam_mtx = rosparam.get_param('camera_matrix/data')
     self.cam_rows = rosparam.get_param('camera_matrix/rows')
     self.cam_cols = rosparam.get_param('camera_matrix/cols')
     self.cam_mtx = np.array(
         np.array(self.cam_mtx).reshape(self.cam_rows, self.cam_cols))
     self.dst_mtx = rosparam.get_param('distortion_coefficients/data')
     (self.dst_rows,
      self.dst_cols) = (rosparam.get_param('distortion_coefficients/rows'),
                        rosparam.get_param('distortion_coefficients/cols'))
     self.dst_mtx = np.array(
         np.array(self.dst_mtx).reshape(self.dst_rows, self.dst_cols))
     # ~camera paramters
     self.mono = monocular.Monocular(self.cam_mtx.T, 1.06, 0.0, 0.0, 0.0,
                                     np.array([0.0, 0.0]))
Exemple #2
0
 def __init__(self):
     self.image_pub = rospy.Publisher("debug_image", Image, queue_size=1)
     self.map_pub = rospy.Publisher("world_lane", Image, queue_size=1)
     self.object_pub = rospy.Publisher("objects",
                                       Detection2DArray,
                                       queue_size=1)
     self.loc_pub = rospy.Publisher("vehicle_loc", Lanepoints, queue_size=1)
     self.bridge = CvBridge()
     # camera parameters
     # rosparam.load_file('/home/aj/Desktop/barc_calibrationdata/ost.yaml')
     self.cam_mtx = rosparam.get_param('camera_matrix/data')
     self.cam_rows = rosparam.get_param('camera_matrix/rows')
     self.cam_cols = rosparam.get_param('camera_matrix/cols')
     self.cam_mtx = np.array(
         np.array(self.cam_mtx).reshape(self.cam_rows, self.cam_cols))
     self.dst_mtx = rosparam.get_param('distortion_coefficients/data')
     (self.dst_rows,
      self.dst_cols) = (rosparam.get_param('distortion_coefficients/rows'),
                        rosparam.get_param('distortion_coefficients/cols'))
     self.dst_mtx = np.array(
         np.array(self.dst_mtx).reshape(self.dst_rows, self.dst_cols))
     # ~camera paramters
     self.image_sub = rospy.Subscriber("/usb_cam/image_raw/compressed",
                                       CompressedImage,
                                       self.image_cb,
                                       queue_size=1,
                                       buff_size=2**24)
     self.sess = tf.Session(graph=detection_graph, config=config)
     # intrinsic matrix is transposed as monocular class expects a transposed matrix
     # monocular class can be modified to make the matrix transposed
     self.m = mono.Monocular(
         self.cam_mtx.T, 1.06, 0.0, 0.0, 0.0,
         np.array([0.0, 0.0
                   ]))  # (0.0762, 2.0) is height,pitch for barc real time