def show_hough_image(ibs, gid, species=None, fnum=None, **kwargs): if fnum is None: fnum = pt.next_fnum() title = 'Hough Image: ' + vh.get_image_titles(ibs, gid) print(title) if species is None: species = ibs.get_ #.cfg.detect_cfg.species_text src_gpath_list = ibs.get_image_detectpaths([gid]) dst_gpath_list = [splitext(gpath)[0] for gpath in src_gpath_list] hough_gpath_list = [ gpath + '_' + species + '_hough.png' for gpath in dst_gpath_list ] # Detect with hough config = { 'output_gpath_list': hough_gpath_list, } print('-' * 80) print('') print('WARNING!!!') print('Hough image is not used often and not worth putting into depcache.') print('This image is computed as needed and not cached to disk.') print('') print('-' * 80) results_list = list( randomforest.detect_gpath_list_with_species( # NOQA ibs, src_gpath_list, species, **config)) # Get path hough_gpath = hough_gpath_list[0] img = vt.imread(hough_gpath) fig, ax = viz_image2.show_image(img, title=title, fnum=fnum, **kwargs) return fig, ax
def show_hough_image(ibs, gid, species=None, fnum=None, **kwargs): if fnum is None: fnum = pt.next_fnum() title = 'Hough Image: ' + vh.get_image_titles(ibs, gid) print(title) if species is None: species = ibs.cfg.detect_cfg.species_text src_gpath_list = ibs.get_image_detectpaths([gid]) dst_gpath_list = [splitext(gpath)[0] for gpath in src_gpath_list] hough_gpath_list = [gpath + '_' + species + '_hough.png' for gpath in dst_gpath_list] # Detect with hough config = { 'output_gpath_list': hough_gpath_list, } print('-' * 80) print('') print('WARNING!!!') print('Hough image is not used often and not worth putting into depcache.') print('This image is computed as needed and not cached to disk.') print('') print('-' * 80) results_list = list(randomforest.detect_gpath_list_with_species(ibs, src_gpath_list, species, **config)) # NOQA # Get path hough_gpath = hough_gpath_list[0] img = vt.imread(hough_gpath) fig, ax = viz_image2.show_image(img, title=title, fnum=fnum, **kwargs) return fig, ax
def show_hough(ibs, gid, species, fnum=None, **kwargs): if fnum is None: fnum = df2.next_fnum() title = 'Hough Image: ' + vh.get_image_titles(ibs, gid) print(title) hough_gpath = randomforest.get_image_hough_gpaths(ibs, [gid], species)[0] img = gtool.imread(hough_gpath) fig, ax = viz_image2.show_image(img, title=title, fnum=fnum, **kwargs) return fig, ax
def show_hough_image(ibs, gid, species=None, fnum=None, **kwargs): if fnum is None: fnum = pt.next_fnum() title = 'Hough Image: ' + vh.get_image_titles(ibs, gid) print(title) if species is None: species = ibs.cfg.detect_cfg.species_text src_gpath_list = ibs.get_image_detectpaths([gid]) dst_gpath_list = [splitext(gpath)[0] for gpath in src_gpath_list] hough_gpath_list = [gpath + '_' + species + '_hough.png' for gpath in dst_gpath_list] # Detect with hough config = { 'output_gpath_list': hough_gpath_list, } results_list = list(randomforest.detect_gpath_list_with_species(ibs, src_gpath_list, species, **config)) # NOQA # Get path hough_gpath = hough_gpath_list[0] img = gtool.imread(hough_gpath) fig, ax = viz_image2.show_image(img, title=title, fnum=fnum, **kwargs) return fig, ax
def show_image(ibs, gid, sel_aids=[], fnum=None, annote=True, draw_lbls=True, notitle=False, rich_title=False, pnum=(1, 1, 1), **kwargs): """ Driver function to show images Args: ibs (IBEISController): ibeis controller object gid (int): image row id sel_aids (list): fnum (int): figure number annote (bool): draw_lbls (bool): Returns: tuple: (fig, ax) CommandLine: python -m ibeis.viz.viz_image --test-show_image --show python -m ibeis.viz.viz_image --test-show_image --show --db GZ_ALL python -m ibeis.viz.viz_image --test-show_image --show --db GZ_ALL --gid 100 python -m ibeis.viz.viz_image --test-show_image --show --db PZ_MTEST --aid 10 python -m ibeis.viz.viz_image --test-show_image --show --db PZ_MTEST --aid 91 --no-annot --rich-title python -m ibeis.viz.viz_image --test-show_image --show --db GIR_Tanya --aid 1 --no-annot --rich-title Example: >>> # SLOW_DOCTEST >>> # VIZ_TEST >>> from ibeis.viz.viz_image import * # NOQA >>> import ibeis >>> # build test data >>> ibs = ibeis.opendb(ut.get_argval('--db', str, 'testdb1')) >>> #gid = ibs.get_valid_gids()[0] >>> gid = ut.get_argval('--gid', int, 1) >>> aid = ut.get_argval('--aid', int, None) >>> if aid is not None: >>> gid = ibs.get_annot_gids(aid) >>> sel_aids = [] >>> fnum = None >>> annote = not ut.get_argflag('--no-annot') >>> rich_title = ut.get_argflag('--rich-title') >>> draw_lbls = True >>> # execute function >>> (fig, ax) = show_image(ibs, gid, sel_aids, fnum, annote, draw_lbls, rich_title) >>> pt.show_if_requested() """ if fnum is None: fnum = pt.next_fnum() # Read Image img = ibs.get_images(gid) aid_list = ibs.get_image_aids(gid) if sel_aids == 'all': sel_aids = aid_list annotekw = get_annot_annotations(ibs, aid_list, sel_aids, draw_lbls) annotation_centers = vh.get_bbox_centers(annotekw['bbox_list']) title = vh.get_image_titles(ibs, gid) if rich_title: title += ', aids=%r' % (aid_list) title += ', db=%r' % (ibs.get_dbname()) showkw = { 'title' : title, 'annote' : annote, 'fnum' : fnum, 'pnum' : pnum, } if notitle: del showkw['title'] showkw.update(annotekw) fig, ax = viz_image2.show_image(img, **showkw) # Label the axis with data ph.set_plotdat(ax, 'annotation_centers', annotation_centers) ph.set_plotdat(ax, 'aid_list', aid_list) ph.set_plotdat(ax, 'viztype', 'image') ph.set_plotdat(ax, 'gid', gid) return fig, ax