Exemple #1
0
def gen_chip2_and_write(tup):
    """ worker function for parallel generator """
    cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    #printDBG('write chip: %r' % cfpath)
    gtool.imwrite(cfpath, chipBGR)
    return cfpath
Exemple #2
0
def testshow_extramargin_info(ibs, aid_list, arg_list, newsize_list, halfoffset_cs_list):
    #cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    # TEMP TESTING
    from vtool import chip as ctool
    import plottool as pt
    import vtool as vt
    from ibeis.viz import viz_chip

    index = 0
    cfpath, gfpath, bbox, theta, new_size, filter_list = arg_list[index]
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    bbox_cs_list = [
        (xo_pcs, yo_pcs, w_pcs, h_pcs)
        for (w_pcs, h_pcs), (xo_pcs, yo_pcs) in zip(newsize_list, halfoffset_cs_list)
    ]
    bbox_pcs = bbox_cs_list[index]
    aid = aid_list[0]
    print('new_size = %r' % (new_size,))
    print('newsize_list[index] = %r' % (newsize_list[index],))

    fnum = 1
    viz_chip.show_chip(ibs, aid, pnum=(1, 3, 1), fnum=fnum, annote=False, in_image=True ,
                       title_suffix='\noriginal image')
    viz_chip.show_chip(ibs, aid, pnum=(1, 3, 2), fnum=fnum, annote=False,
                       title_suffix='\noriginal chip')
    bboxed_chip = vt.draw_verts(chipBGR,
                                vt.scaled_verts_from_bbox(bbox_pcs, theta, 1, 1))
    pt.imshow(bboxed_chip, pnum=(1, 3, 3), fnum=fnum,
              title='scaled chip with expanded margin.\n(orig margin drawn in orange)')

    pt.show_if_requested()
Exemple #3
0
def gen_detectchip(tup):
    r"""
    Parallel worker. Crops chip out of an image, applies filters, etc
    """
    cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    gtool.imwrite(cfpath, chipBGR)
    return cfpath
Exemple #4
0
def gen_detectchip(tup):
    r"""
    Parallel worker. Crops chip out of an image, applies filters, etc
    """
    cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    gtool.imwrite(cfpath, chipBGR)
    return cfpath
Exemple #5
0
def testshow_extramargin_info(ibs, aid_list, arg_list, newsize_list,
                              halfoffset_cs_list):
    #cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    # TEMP TESTING
    from vtool import chip as ctool
    import plottool as pt
    import vtool as vt
    from ibeis.viz import viz_chip

    index = 0
    cfpath, gfpath, expanded_bbox, theta, expanded_new_size, filter_list = arg_list[
        index]
    expanded_chipBGR = ctool.compute_chip(gfpath, expanded_bbox, theta,
                                          expanded_new_size, filter_list)
    bbox_cs_list = [
        (xo_pcs, yo_pcs, w_pcs, h_pcs)
        for (w_pcs, h_pcs), (xo_pcs,
                             yo_pcs) in zip(newsize_list, halfoffset_cs_list)
    ]
    bbox_pcs = bbox_cs_list[index]
    aid = aid_list[0]
    #print('new_size = %r' % (new_size,))
    print('newsize_list[index] = %r' % (newsize_list[index], ))

    fnum = 1
    viz_chip.show_chip(ibs,
                       aid,
                       pnum=(1, 3, 1),
                       fnum=fnum,
                       annote=False,
                       in_image=True,
                       title_suffix='\noriginal image')
    viz_chip.show_chip(ibs,
                       aid,
                       pnum=(1, 3, 2),
                       fnum=fnum,
                       annote=False,
                       title_suffix='\noriginal chip')
    bboxed_chip = vt.draw_verts(
        expanded_chipBGR, vt.scaled_verts_from_bbox(bbox_pcs, theta, 1, 1))
    pt.imshow(
        bboxed_chip,
        pnum=(1, 3, 3),
        fnum=fnum,
        title='scaled chip with expanded margin.\n(orig margin drawn in orange)'
    )
    pt.gca().set_xlabel(str(bboxed_chip.shape))
    pt.show_if_requested()
Exemple #6
0
def gen_chip2_no_write(tup):
    """ worker function for parallel generator """
    cfpath, gfpath, bbox, theta, new_size, filter_list = tup
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    return chipBGR, cfpath
Exemple #7
0
def gen_chip(cfpath, gfpath, bbox, theta, new_size, filter_list=[]):
    """ worker function for parallel process """
    chipBGR = ctool.compute_chip(gfpath, bbox, theta, new_size, filter_list)
    return chipBGR, cfpath