def preprocess_general(infile, outfile, output_size):
    logger.info('Preprocessing file %r' % infile)
    
    distance = image_distance_L1
    
    diff_threshold = find_dt_threshold(infile,
                                       topic_image_raw, distance=distance,
                                       ignore_first=100, max_images=200)
    
    
    zoomer = Zoomer(use_zoom=False, output_size=output_size,
                    min_zoom=100, max_zoom=101, zoom_factor=0)

    bag = rosbag.Bag(infile)
    info = yaml.load(bag._get_yaml_info())
    for topic_dict in info['topics']:
        if 'FloatArray' in topic_dict['type']:
            command_topic = topic_dict['topic']
    
    logger.info('Using command topick: %s' % command_topic)

    data_stream = read_processed_data(infile, zoomer, command_topic)
    tuples_stream = read_Y0UY1_tuples(data_stream,
                                      image_distance=distance,
                                      threshold=diff_threshold)
    
    out_bag = rosbag.Bag(outfile, 'w')

    for Y0, U, Y1 in tuples_stream:
        write_tuple_to_bag(out_bag, Y0, U, Y1, x=None)

    out_bag.close()
def preprocess(infile, outfile, output_size,
                use_zoom=True,
                min_zoom=100, max_zoom=200, zoom_factor=5):
    logger.info('Preprocessing file %r' % infile)
    
    distance = image_distance_L1
    
    diff_threshold = find_dt_threshold(infile,
                                           topic_image_raw, distance=distance,
                                           ignore_first=100, max_images=300)
    
    
    zoomer = Zoomer(use_zoom=use_zoom,
                    min_zoom=min_zoom,
                    max_zoom=max_zoom,
                    zoom_factor=zoom_factor,
                    output_size=output_size)
    
    data_stream = read_processed_data(infile, zoomer)
    tuples_stream = read_Y0UY1_tuples(data_stream,
                                      image_distance=distance,
                                      threshold=diff_threshold)
    
    out_bag = rosbag.Bag(outfile, 'w')
#    i = 0
    for Y0, U, Y1 in tuples_stream:
        write_tuple_to_bag(out_bag, Y0, U, Y1, x=zoomer.current_zoom)
#        i += 1
#        if i > 20:
#            break
    out_bag.close()
Exemple #3
0
def preprocess(infile,
               outfile,
               output_size,
               use_zoom=True,
               min_zoom=100,
               max_zoom=200,
               zoom_factor=5):
    logger.info('Preprocessing file %r' % infile)

    distance = image_distance_L1

    diff_threshold = find_dt_threshold(infile,
                                       topic_image_raw,
                                       distance=distance,
                                       ignore_first=100,
                                       max_images=300)

    zoomer = Zoomer(use_zoom=use_zoom,
                    min_zoom=min_zoom,
                    max_zoom=max_zoom,
                    zoom_factor=zoom_factor,
                    output_size=output_size)

    data_stream = read_processed_data(infile, zoomer)
    tuples_stream = read_Y0UY1_tuples(data_stream,
                                      image_distance=distance,
                                      threshold=diff_threshold)

    out_bag = rosbag.Bag(outfile, 'w')
    #    i = 0
    for Y0, U, Y1 in tuples_stream:
        write_tuple_to_bag(out_bag, Y0, U, Y1, x=zoomer.current_zoom)


#        i += 1
#        if i > 20:
#            break
    out_bag.close()
Exemple #4
0
def preprocess_general(infile, outfile, output_size):
    logger.info('Preprocessing file %r' % infile)

    distance = image_distance_L1

    diff_threshold = find_dt_threshold(infile,
                                       topic_image_raw,
                                       distance=distance,
                                       ignore_first=100,
                                       max_images=200)

    zoomer = Zoomer(use_zoom=False,
                    output_size=output_size,
                    min_zoom=100,
                    max_zoom=101,
                    zoom_factor=0)

    bag = rosbag.Bag(infile)
    info = yaml.load(bag._get_yaml_info())
    for topic_dict in info['topics']:
        if 'FloatArray' in topic_dict['type']:
            command_topic = topic_dict['topic']

    logger.info('Using command topick: %s' % command_topic)

    data_stream = read_processed_data(infile, zoomer, command_topic)
    tuples_stream = read_Y0UY1_tuples(data_stream,
                                      image_distance=distance,
                                      threshold=diff_threshold)

    out_bag = rosbag.Bag(outfile, 'w')

    for Y0, U, Y1 in tuples_stream:
        write_tuple_to_bag(out_bag, Y0, U, Y1, x=None)

    out_bag.close()