def __test_warp(Vtup, testname, fignum): H_21 = Vtup[2] with Timer(msg='Warped with H from ' + testname): rchip2_W = warp_chip(rchip2, H_21, rchip1) if __SHOW_WARP__: title_str = testname + ' Result rchip2_W' print(' * Showing: ' + str(title_str)) df2.imshow(rchip2_W, fignum=fignum + 1, title=title_str) return rchip2_W
def __test_warp(Vtup, testname, fignum): H_21 = Vtup[2] with Timer(msg='Warped with H from '+testname): rchip2_W = warp_chip(rchip2, H_21, rchip1) if __SHOW_WARP__: title_str = testname+' Result rchip2_W' print(' * Showing: '+str(title_str)) df2.imshow(rchip2_W, fignum=fignum+1, title=title_str) return rchip2_W
def show_all_detector_types(fignum=0, pyramid=True, grid=True, compare=False): print('Detecting features of all types') if compare: show_all_detector_types(fignum=1.221, pyramid=False, grid=False) show_all_detector_types(fignum=1.222, pyramid=False, grid=True) show_all_detector_types(fignum=1.223, pyramid=True, grid=False) show_all_detector_types(fignum=1.224, pyramid=True, grid=True) return test_img = test_img1() for xx, detector_type in enumerate(fc2.cv2_detector_types): detector_args = ['','+grid'][grid]+['','+pyramid'][pyramid] print('Testing detector=%s' % (detector_type+detector_args)) try: cvkpts = fc2.cv2_kpts(test_img, detector_type, pyramid=pyramid, grid=grid) _img = df2.cv2_draw_kpts(test_img, cvkpts) df2.imshow(_img, fignum=fignum+xx, title='%s #kpts=%d ' % (detector_args, len(cvkpts)), figtitle=detector_type) except Exception as ex: print(repr(ex))
def show_all_detector_types(fignum=0, pyramid=True, grid=True, compare=False): print('Detecting features of all types') if compare: show_all_detector_types(fignum=1.221, pyramid=False, grid=False) show_all_detector_types(fignum=1.222, pyramid=False, grid=True) show_all_detector_types(fignum=1.223, pyramid=True, grid=False) show_all_detector_types(fignum=1.224, pyramid=True, grid=True) return test_img = test_img1() for xx, detector_type in enumerate(fc2.cv2_detector_types): detector_args = ['', '+grid'][grid] + ['', '+pyramid'][pyramid] print('Testing detector=%s' % (detector_type + detector_args)) try: cvkpts = fc2.cv2_kpts(test_img, detector_type, pyramid=pyramid, grid=grid) _img = df2.cv2_draw_kpts(test_img, cvkpts) df2.imshow(_img, fignum=fignum + xx, title='%s #kpts=%d ' % (detector_args, len(cvkpts)), figtitle=detector_type) except Exception as ex: print(repr(ex))
# INPUT CHIPS cx = other_cx[__OTHER_X__] desc1 = cx2_desc[qcx] desc2 = cx2_desc[cx] kpts1 = cx2_kpts[qcx] kpts2 = cx2_kpts[cx] rchip1 = cv2.imread(cx2_rchip_path[qcx]) rchip2 = cv2.imread(cx2_rchip_path[cx]) print('---------------------------------------') print(' * Inspecting match to: cx = %d' % cx) print('Drawing chips we are inspecting') print(' * rchip1.shape = %r ' % (rchip1.shape, )) print(' * rchip2.shape = %r ' % (rchip2.shape, )) if __SHOW_PLAIN_CHIPS__: df2.imshow(rchip1, fignum=9001, title='querychip qcx=%d' % qcx) df2.imshow(rchip2, fignum=9002, title='reschip cx=%d' % cx) if __SHOW_KPTS_CHIPS__: df2.show_keypoints(rchip1, kpts1, fignum=902, title='qcx=%d nkpts=%d' % (qcx, len(kpts1))) df2.show_keypoints(rchip2, kpts2, fignum=903, title='cx=%d nkpts=%d' % (cx, len(kpts1))) # ASSIGNED MATCHES print('---------------------------------------') print(' INFO: Assigned feature matches ') fm = cx2_fm[cx]
# INPUT CHIPS cx = other_cx[__OTHER_X__] desc1 = cx2_desc[qcx] desc2 = cx2_desc[cx] kpts1 = cx2_kpts[qcx] kpts2 = cx2_kpts[cx] rchip1 = cv2.imread(cx2_rchip_path[qcx]) rchip2 = cv2.imread(cx2_rchip_path[cx]) print('---------------------------------------') print(' * Inspecting match to: cx = %d' % cx) print('Drawing chips we are inspecting') print(' * rchip1.shape = %r ' % (rchip1.shape,)) print(' * rchip2.shape = %r ' % (rchip2.shape,)) if __SHOW_PLAIN_CHIPS__: df2.imshow(rchip1, fignum=9001, title='querychip qcx=%d' % qcx) df2.imshow(rchip2, fignum=9002, title='reschip cx=%d' % cx) if __SHOW_KPTS_CHIPS__: df2.show_keypoints(rchip1, kpts1, fignum=902, title='qcx=%d nkpts=%d' % (qcx,len(kpts1))) df2.show_keypoints(rchip2, kpts2, fignum=903, title='cx=%d nkpts=%d' % (cx,len(kpts1))) # ASSIGNED MATCHES print('---------------------------------------') print(' INFO: Assigned feature matches ') fm = cx2_fm[cx] fs = cx2_fs[cx] print(' * feature matches (assigned) fm.shape = %r' % (fm.shape,)) print(' * kpts1.shape %r' % (kpts1.shape,)) print(' * kpts2.shape %r' % (kpts2.shape,))