コード例 #1
0
ファイル: interact.py プロジェクト: Erotemic/hotspotter
 def _select_ith_kpt(fx):
     print_('[interact] viewing ith=%r keypoint' % fx)
     # Get the fx-th keypiont
     kp, sift = kpts[fx], desc[fx]
     # Draw the image with keypoint fx highlighted
     _viz_keypoints(fnum, (2, 1, 1), sel_fx=fx)
     # Draw the selected feature
     nRows, nCols, px = (2, 3, 3)
     viz.draw_feat_row(rchip, fx, kp, sift, fnum, nRows, nCols, px, None)
コード例 #2
0
ファイル: interact.py プロジェクト: Erotemic/hotspotter
 def _select_ith_kpt(fx):
     # Get the fx-th keypiont
     kpts = hs.get_kpts(cx)
     desc = hs.get_desc(cx)
     kp, sift = kpts[fx], desc[fx]
     # Draw chip + keypoints + highlighted plots
     _chip_view(pnum=(2, 1, 1), sel_fx=fx)
     # Draw the selected feature plots
     nRows, nCols, px = (2, 3, 3)
     viz.draw_feat_row(rchip, fx, kp, sift, fnum, nRows, nCols, px, None)
コード例 #3
0
ファイル: interact.py プロジェクト: Erotemic/hotspotter
    def _select_ith_match(mx, qcx, cx):
        #----------------------
        # Get info for the _select_ith_match plot
        annote_ptr[0] = 1
        # Get the mx-th feature match
        cx1, cx2 = qcx, cx
        fx1, fx2 = fm[mx]
        fscore2  = res.cx2_fs[cx2][mx]
        fk2      = res.cx2_fk[cx2][mx]
        kpts1, kpts2 = hs.get_kpts([cx1, cx2])
        desc1, desc2 = hs.get_desc([cx1, cx2])
        kp1, kp2     = kpts1[fx1], kpts2[fx2]
        sift1, sift2 = desc1[fx1], desc2[fx2]
        info1 = '\nquery'
        info2 = '\nk=%r fscore=%r' % (fk2, fscore2)
        last_state.last_fx = fx1

        # Extracted keypoints to draw
        extracted_list = [(rchip1, kp1, sift1, fx1, cx1, info1),
                          (rchip2, kp2, sift2, fx2, cx2, info2)]
        # Normalizng Keypoint
        if hasattr(res, 'filt2_meta') and 'lnbnn' in res.filt2_meta:
            qfx2_norm = res.filt2_meta['lnbnn']
            # Normalizing chip and feature
            (cx3, fx3, normk) = qfx2_norm[fx1]
            rchip3 = hs.get_chip(cx3)
            kp3 = hs.get_kpts(cx3)[fx3]
            sift3 = hs.get_desc(cx3)[fx3]
            info3 = '\nnorm %s k=%r' % (hs.cidstr(cx3), normk)
            extracted_list.append((rchip3, kp3, sift3, fx3, cx3, info3))
        else:
            print('WARNING: meta doesnt exist')

        #----------------------
        # Draw the _select_ith_match plot
        nRows, nCols = len(extracted_list) + same_fig, 3
        # Draw matching chips and features
        sel_fm = np.array([(fx1, fx2)])
        pnum1 = (nRows, 1, 1) if same_fig else (1, 1, 1)
        _chipmatch_view(pnum1, vert=False, ell_alpha=.4, ell_linewidth=1.8,
                        colors=df2.BLUE, sel_fm=sel_fm, **kwargs)
        # Draw selected feature matches
        px = nCols * same_fig  # plot offset
        prevsift = None
        if not same_fig:
            fnum2 = fnum + len(viz.FNUMS)
            fig2 = df2.figure(fnum=fnum2, docla=True, doclf=True)
        else:
            fnum2 = fnum
        for (rchip, kp, sift, fx, cx, info) in extracted_list:
            px = viz.draw_feat_row(rchip, fx, kp, sift, fnum2, nRows, nCols, px,
                                   prevsift=prevsift, cx=cx, info=info)
            prevsift = sift
        if not same_fig:
            df2.connect_callback(fig2, 'button_press_event', _click_chipres_click)
            df2.set_figtitle(figtitle + hs.vs_str(qcx, cx))