示例#1
0
 def match(self, af0, af1):
     Xs = vop.array([k[0] for k in af1.kp])
     Ys = vop.array([k[1] for k in af1.kp])
     pairs = []
     for (i, (ki, di)) in enumerate(zip(af0.kp, af0.descriptors)):
         # hits = (Numeric.logical_and(Numeric.absolute(NXs - ki[0]) < 64, Numeric.absolute(NYs - ki[1]) < 32)).astype(Numeric.UnsignedInt8).tostring()
         predX = (abs(Xs - ki[0]) < 64)
         predY = (abs(Ys - ki[1]) < 32)
         hits = vop.where(predX & predY, 1, 0).tostring()
         best = VO.sad_search(di, af1.descriptors, hits)
         if best != None:
             pairs.append((i, best, 0))
     return pairs
示例#2
0
 def match(self, af0, af1):
   Xs = vop.array([k[0] for k in af1.kp])
   Ys = vop.array([k[1] for k in af1.kp])
   pairs = []
   for (i,(ki,di)) in enumerate(zip(af0.kp,af0.descriptors)):
     # hits = (Numeric.logical_and(Numeric.absolute(NXs - ki[0]) < 64, Numeric.absolute(NYs - ki[1]) < 32)).astype(Numeric.UnsignedInt8).tostring()
     predX = (abs(Xs - ki[0]) < 64)
     predY = (abs(Ys - ki[1]) < 32)
     hits = vop.where(predX & predY, 1, 0).tostring()
     best = VO.sad_search(di, af1.descriptors, hits)
     if best != None:
       pairs.append((i, best, 0))
   return pairs
示例#3
0
def do_stereo_sparse(refpat, rgrad, x, y, xim, yim, ftzero, dlen, tfilter_thresh, ufilter_thresh):
    if x < dlen or y < 7 or y > (yim - 8):
        return -1
    tiles = [VO.grab_16x16(rgrad, xim, (x - dlen + 1) + i - 7, y - 7) for i in range(dlen)]

    ind = VO.sad_search(refpat, tiles, chr(1) * dlen)
    # do interpolation
    if ind == 0 or ind == (dlen - 1):
        return (dlen - ind - 1) * 16

    c = VO.sad(refpat, tiles[ind])
    p = VO.sad(refpat, tiles[ind + 1])
    n = VO.sad(refpat, tiles[ind - 1])
    v = float(dlen - ind - 1) + (p - n) / (2 * (p + n - 2 * c))
    return 0.5 + 16 * v
示例#4
0
def do_stereo_sparse(refpat, rgrad, x, y, xim, yim, ftzero, dlen,
                     tfilter_thresh, ufilter_thresh):
    if x < dlen or y < 7 or y > (yim - 8):
        return -1
    tiles = [
        VO.grab_16x16(rgrad, xim, (x - dlen + 1) + i - 7, y - 7)
        for i in range(dlen)
    ]

    ind = VO.sad_search(refpat, tiles, chr(1) * dlen)
    # do interpolation
    if (ind == 0 or ind == (dlen - 1)):
        return (dlen - ind - 1) * 16

    c = VO.sad(refpat, tiles[ind])
    p = VO.sad(refpat, tiles[ind + 1])
    n = VO.sad(refpat, tiles[ind - 1])
    v = float(dlen - ind - 1) + (p - n) / (2 * (p + n - 2 * c))
    return (0.5 + 16 * v)