Exemplo n.º 1
0
def CreateDatasetFromRosbag(rosbagName,
                            pickleName,
                            isBebop=True,
                            start_frame=None,
                            end_frame=None):
    """Converts rosbag to format suitable for training/testing. 
	if start_frame, end_frame are unknown, FrameSelector will help you choose how to trim the video

    Parameters
    ----------
    rosbagName : str
        The file location of the rosbag
    pickleName : str
        name of the new .pickle file
    isBebop : bool, optional
        True if you want RGB dataset for the bebop, False if you want Himax-tailored dataset
    start_frame : int, optional
        if known, the timestamp in ns of the frame you wish to start from 
    end_frame : int, optional
        if known, the timestamp in ns of the frame you wish to finish at
    """

    dc = DatasetCreator(rosbagName)
    if (start_frame is None) or (end_frame is None):
        start_frame, end_frame = dc.FrameSelector()

    if isBebop == True:
        dc.CreateBebopDataset(0, pickleName, start_frame, end_frame)
    else:
        dc.CreateHimaxDataset(config.himax_delay, pickleName, start_frame,
                              end_frame)
def CreatePickle(subject_name, rosbagfolder, delay=0):

    rosbagName = rosbagfolder + subject_name + ".bag"
    pickleName = config.folder_path + "/../Pickles/16_4_2020/" + subject_name + ".pickle"
    dc = DatasetCreator(rosbagName)

    dc.CreateHimaxDataset(delay, pickleName, "/image_raw", "optitrack/gapuino",
                          ["optitrack/head"])
def ProcessAllFilesInFolder(rosbag_folder, pickle_folder):
    files = os.listdir(rosbag_folder)

    for f in files:

        #print(f)
        dc = DatasetCreator(rosbag_folder + f)
        pickleName = pickle_folder + os.path.splitext(
            os.path.basename(f))[0] + ".pickle"
        #print(pickleName)
        dc.CreateHimaxDataset(0, pickleName, "/image_raw", "optitrack/gapuino",
                              ["optitrack/head"])
Exemplo n.º 4
0
def main():
    # subject_name = "davide1"
    # rosbagName = config.folder_path + "/data/Hand/" + subject_name + ".bag"
    # pickleName = config.folder_path + "/data/Hand/" + subject_name + "Hand.pickle"
    # CreateDatasetFromRosbag(rosbagName, pickleName, isBebop=True, start_frame=None, end_frame=None)

    subject_name = "session3"
    rosbagName = config.folder_path + "/data/compressed/" + subject_name + ".bag"
    pickleName = config.folder_path + "/data/compressed/" + subject_name + ".pickle"
    #CreateDatasetFromDarioRosbag(rosbagName, pickleName, start_frame=None, end_frame=None)

    dc = DatasetCreator(rosbagName)
    #dc.CreateBebopDataset(0, pickleName, "bebop/image_raw/compressed", "optitrack/drone", ["optitrack/head", "optitrack/hand"])
    dc.CreateHimaxDataset(config.himax_delay, pickleName, "himax_camera",
                          "bebop/image_raw/compressed", "optitrack/drone",
                          ["optitrack/head", "optitrack/hand"])