示例#1
0
def run_experiment_3(cs, cs_c, edge_map, th, th_c, metric, graph_annot,
                     rgb_dir, _id):

    # Run experiment
    junctions, juncs_on, lines_on = reconstructBuilding(
        cs,
        edge_map,
        use_junctions_with_var=True,
        thetas=th,
        angle_thresh=5,
        with_corner_edge_confidence=True,
        corner_confs=cs_c,
        theta_confs=th_c,
        theta_threshold=0.25,
        corner_edge_thresh=0.125,
        edge_map_weight=10.0,
        intersection_constraint=True,
        post_process=True)

    # Draw output image
    dwg = svgwrite.Drawing('../results/svg_regions/{}_3.svg'.format(_id),
                           (128, 128))
    im_path = os.path.join(rgb_dir, _id + '.jpg')
    draw_building(dwg, junctions, juncs_on, lines_on)
    dwg.save()

    # Update metric
    metric.forward(graph_annot, junctions, juncs_on, lines_on, _id)

    return metric
示例#2
0
def run_experiment_2(cs, cs_c, edge_map, th, th_c, metric, graph_annot,
                     rgb_dir, _id):

    # Run experiment
    junctions, juncs_on, lines_on = reconstructBuilding(
        cs,
        edge_map,
        coner_to_edge_constraint=True,  # corner-to-edge
        thetas=th,  # corner-to-edge
        angle_thresh=5,  # corner-to-edge
        with_corner_edge_confidence=True,  # corners + edges
        corner_edge_thresh=0.125,  # corners + edges        
        edge_map_weight=10.0,  # edges           
        corner_confs=cs_c,  # corners
        theta_confs=th_c,  # corner-to-edge
        theta_threshold=0.25,  # corner-to-edge
        intersection_constraint=True,  # intersection 
        with_corner_variables=True,  # connectivity
        corner_min_degree_constraint=True,  # degree
        post_process=True)

    # Draw output image
    dwg = svgwrite.Drawing('../results/svg_regions/{}_2.svg'.format(_id),
                           (128, 128))
    im_path = os.path.join(rgb_dir, _id + '.jpg')
    draw_building(dwg, junctions, juncs_on, lines_on)
    dwg.save()

    # Update metric
    metric.forward(graph_annot, junctions, juncs_on, lines_on, _id)

    return metric
示例#3
0
def run_experiment_0(cs, edge_map, th_filtered, metric, graph_annot, rgb_dir,
                     _id):

    # Run experiment
    junctions, juncs_on, lines_on = reconstructBuilding(
        cs,
        edge_map,
        edge_threshold=0.5,
        with_edge_confidence=True,  # edges
        edge_map_weight=10.0,  # edges
        intersection_constraint=True,  # intersection 
        with_corner_variables=True,  # connectivity
        corner_min_degree_constraint=True,  # degree
        post_process=True)

    # Draw output image
    dwg = svgwrite.Drawing('../results/svg_regions/{}_0.svg'.format(_id),
                           (128, 128))
    im_path = os.path.join(rgb_dir, _id + '.jpg')
    draw_building(dwg, junctions, juncs_on, lines_on)
    dwg.save()

    # Update metric
    metric.forward(graph_annot, junctions, juncs_on, lines_on, _id)

    return
示例#4
0
def run_experiment_1(cs, edge_map, th_filtered, metric, graph_annot, rgb_dir,
                     _id):

    junctions, juncs_on, lines_on = reconstructBuilding(
        cs,
        edge_map,
        use_junctions=True,
        thetas=th_filtered,
        angle_thresh=5,
        edge_threshold=0.5,
        with_edge_confidence=True,
        use_edge_classifier=False,
        edge_map_weight=10.0,
        intersection_constraint=True,
        post_process=True)

    # Draw output image
    dwg = svgwrite.Drawing('../results/svg_regions/{}_1.svg'.format(_id),
                           (128, 128))
    im_path = os.path.join(rgb_dir, _id + '.jpg')
    draw_building(dwg, junctions, juncs_on, lines_on)
    dwg.save()

    # Update metric
    metric.forward(graph_annot, junctions, juncs_on, lines_on, _id)

    return
示例#5
0
def run_experiment_5(cs, cs_c, edge_map, th, th_c, metric, graph_annot,
                     region_mks, shared_edges, rgb_dir, _id):

    # Run experiment
    junctions, juncs_on, lines_on, regs_sm_on = reconstructBuilding(
        cs,
        edge_map,
        use_junctions_with_var=True,
        thetas=th,
        angle_thresh=5,
        with_corner_edge_confidence=True,
        corner_confs=cs_c,
        theta_confs=th_c,
        theta_threshold=0.25,
        corner_edge_thresh=0.125,
        edge_map_weight=10.0,
        intersection_constraint=True,
        post_process=True,
        corner_min_degree_constraint=True,
        with_corner_variables=True,
        junctions_soft=True,
        use_regions=True,
        region_intersection_constraint=True,
        region_hit_threshold=0.1,
        regions=region_mks,
        shared_edges=None,
        closed_region_constraint=True,
        _id=_id)

    # Draw regions
    im_path = '{}/{}.jpg'.format(rgb_dir, _id)
    reg_im = Image.fromarray(np.ones((256, 256)) * 255).convert('RGB')
    dr = ImageDraw.Draw(reg_im)
    for m in regs_sm_on:
        r = random.randint(0, 255)
        g = random.randint(0, 255)
        b = random.randint(0, 255)
        dr.bitmap((0, 0), m.convert('L'), fill=(r, g, b, 128))
    reg_im.save('./regions/{}.jpg'.format(_id))

    # Draw output image
    dwg = svgwrite.Drawing('../results/svg_regions/{}_5.svg'.format(_id),
                           (128, 128))
    dwg.add(
        svgwrite.image.Image(os.path.abspath('./regions/{}.jpg'.format(_id)),
                             size=(128, 128)))
    im_path = os.path.join(rgb_dir, _id + '.jpg')
    draw_building(dwg, junctions, juncs_on, lines_on)
    dwg.save()

    # Update metric
    metric.forward(graph_annot, junctions, juncs_on, lines_on, _id)

    return metric