Exemplo n.º 1
0
 def collect_descriptors_sad(self, frame):
     self.timer['descriptor_collection'].start()
     frame.descriptors = [
         VO.grab_16x16(frame.rawdata, frame.size[0], p[0] - 7, p[1] - 7)
         for p in frame.kp
     ]
     self.timer['descriptor_collection'].stop()
Exemplo n.º 2
0
 def collect(self, frame):
     lgrad = " " * (frame.size[0] * frame.size[1])
     VO.ost_do_prefilter_norm(frame.rawdata, lgrad, frame.size[0],
                              frame.size[1], 31, scratch)
     frame.descriptors = [
         VO.grab_16x16(lgrad, frame.size[0], p[0] - 7, p[1] - 7)
         for p in frame.kp
     ]
Exemplo n.º 3
0
    def lookup_disparity(self, x, y):
        (w, h) = self.size
        refpat = VO.grab_16x16(self.lgrad, w, x - 7, y - 7)

        # ftzero         31
        # dlen           64
        # tfilter_thresh 10
        # ufilter_thresh 15

        v = VO.ost_do_stereo_sparse(refpat, self.rgrad, x, y, w, h, 31, 64, 10, 15)

        if v < 0:
            return None
        else:
            return v / 16.0
Exemplo n.º 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
Exemplo n.º 5
0
    def lookup_disparity(self, x, y):
        (w, h) = self.size
        refpat = VO.grab_16x16(self.lgrad, w, x - 7, y - 7)

        # ftzero         31
        # dlen           64
        # tfilter_thresh 10
        # ufilter_thresh 15

        v = VO.ost_do_stereo_sparse(refpat, self.rgrad, x, y, w, h, 31, 64, 10,
                                    15)

        if v < 0:
            return None
        else:
            return v / 16.
Exemplo n.º 6
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)
Exemplo n.º 7
0
 def collect(self, frame):
   lgrad = " " * (frame.size[0] * frame.size[1])
   VO.ost_do_prefilter_norm(frame.rawdata, lgrad, frame.size[0], frame.size[1], 31, scratch)
   frame.descriptors = [ VO.grab_16x16(lgrad, frame.size[0], p[0]-7, p[1]-7) for p in frame.kp ]
 def collect_descriptors_sad(self, frame):
   self.timer['descriptor_collection'].start()
   frame.descriptors = [ VO.grab_16x16(frame.rawdata, frame.size[0], p[0]-7, p[1]-7) for p in frame.kp ]
   self.timer['descriptor_collection'].stop()