def show_matches_(key, **kwargs): assert key in key_list, 'unknown key=%r' % (key, ) showkw = locals_.copy() pnum = next_pnum() showkw['pnum'] = pnum showkw['fnum'] = fnum showkw.update(kwargs) _fm, _fs = matchtup_dict[key] title = keytitle_dict[key] if kwargs.get('coverage'): from vtool import coverage_kpts kpts2, rchip2 = ut.dict_get(locals_, ('kpts2', 'rchip2')) kpts2_m = kpts2.take(_fm.T[1], axis=0) chipshape2 = rchip2.shape chipsize2 = chipshape2[0:2][::-1] coverage_mask = coverage_kpts.make_kpts_coverage_mask( kpts2_m, chipsize2, fx2_score=_fs, resize=True, return_patch=False) pt.imshow(coverage_mask * 255, pnum=pnum, fnum=fnum) else: if kwargs.get('norm', False): _fm = normtup_dict[key] assert _fm is not None, key showkw['cmap'] = 'cool' title += ' normalizers' show_matches(_fm, _fs, title=title, key=key, **showkw)
def compute_dstncvs_mask(annot): keys = ["kpts", "chipshape", "dstncvs"] kpts, chipshape, dstncvs = ut.dict_take(annot.__dict__, keys) chipsize = chipshape[0:2][::-1] dstncvs_mask = coverage_kpts.make_kpts_coverage_mask( kpts, chipsize, dstncvs, mode="max", resize=True, return_patch=False ) annot.dstncvs_mask = dstncvs_mask
def compute_fgweight_mask(annot): keys = ["kpts", "chipshape", "fgweights"] kpts, chipshape, fgweights = ut.dict_take(annot.__dict__, keys) chipsize = chipshape[0:2][::-1] fgweight_mask = coverage_kpts.make_kpts_coverage_mask( kpts, chipsize, fgweights, mode="max", resize=True, return_patch=False ) annot.fgweight_mask = fgweight_mask
def compute_coverage_mask(match): """ compute matching coverage of annot """ fm = match.fm fs = match.fs kpts2 = match.annot2.kpts chipshape2 = match.annot2.chipshape chipsize2 = chipshape2[0:2][::-1] kpts2_m = kpts2.take(fm.T[1], axis=0) coverage_mask2 = coverage_kpts.make_kpts_coverage_mask( kpts2_m, chipsize2, fs, mode="max", resize=True, return_patch=False ) match.coverage_mask2 = coverage_mask2
def compute_dstncvs_mask(annot): keys = ['kpts', 'chipshape', 'dstncvs'] kpts, chipshape, dstncvs = ut.dict_take(annot.__dict__, keys) chipsize = chipshape[0:2][::-1] dstncvs_mask = coverage_kpts.make_kpts_coverage_mask( kpts, chipsize, dstncvs, mode='max', resize=True, return_patch=False) annot.dstncvs_mask = dstncvs_mask
def compute_fgweight_mask(annot): keys = ['kpts', 'chipshape', 'fgweights'] kpts, chipshape, fgweights = ut.dict_take(annot.__dict__, keys) chipsize = chipshape[0:2][::-1] fgweight_mask = coverage_kpts.make_kpts_coverage_mask( kpts, chipsize, fgweights, mode='max', resize=True, return_patch=False) annot.fgweight_mask = fgweight_mask
def compute_coverage_mask(match): """ compute matching coverage of annot """ fm = match.fm fs = match.fs kpts2 = match.annot2.kpts chipshape2 = match.annot2.chipshape chipsize2 = chipshape2[0:2][::-1] kpts2_m = kpts2.take(fm.T[1], axis=0) coverage_mask2 = coverage_kpts.make_kpts_coverage_mask( kpts2_m, chipsize2, fs, mode='max', resize=True, return_patch=False) match.coverage_mask2 = coverage_mask2
def show_matches_(key, **kwargs): assert key in key_list, 'unknown key=%r' % (key,) showkw = locals_.copy() pnum = next_pnum() showkw['pnum'] = pnum showkw['fnum'] = fnum showkw.update(kwargs) _fm, _fs = matchtup_dict[key] title = keytitle_dict[key] if kwargs.get('coverage'): from vtool import coverage_kpts kpts2, rchip2 = ut.dict_get(locals_, ('kpts2', 'rchip2')) kpts2_m = kpts2.take(_fm.T[1], axis=0) chipshape2 = rchip2.shape chipsize2 = chipshape2[0:2][::-1] coverage_mask = coverage_kpts.make_kpts_coverage_mask(kpts2_m, chipsize2, fx2_score=_fs, resize=True, return_patch=False) pt.imshow(coverage_mask * 255, pnum=pnum, fnum=fnum) else: if kwargs.get('norm', False): _fm = normtup_dict[key] assert _fm is not None, key showkw['cmap'] = 'cool' title += ' normalizers' show_matches(_fm, _fs, title=title, key=key, **showkw)