Exemplo n.º 1
0
    def test_basic(self):
        img1 = np.zeros((128, 128), dtype=np.uint8)
        img2 = np.zeros((128, 128), dtype=np.uint8)

        rand = lambda x: (np.random.random(x) * x).astype(np.uint8)

        img1[rand(128), rand(128)] = 255
        img2[rand(128), rand(128)] = 255

        tc = klt.TrackingContext()
        fl = klt.FeatureList(100)
        klt.select_good_features(tc, img1, fl)
        klt.track_features(tc, img1, img2, fl)
        fl.to_image(img2)

        assert_equal(len(fl), 100)

        fa = fl.as_array()
        values = fa['val']
        assert 0 <= len(values[values != -1]) <= 100
Exemplo n.º 2
0
    def test_basic(self):
        img1 = np.zeros((128, 128), dtype=np.uint8)
        img2 = np.zeros((128, 128), dtype=np.uint8)

        rand = lambda x: (np.random.random(x) * x).astype(np.uint8)

        img1[rand(128), rand(128)] = 255
        img2[rand(128), rand(128)] = 255

        tc = klt.TrackingContext()
        fl = klt.FeatureList(100)
        klt.select_good_features(tc, img1, fl)
        klt.track_features(tc, img1, img2, fl)
        fl.to_image(img2)

        assert_equal(len(fl), 100)

        fa = fl.as_array()
        values = fa['val']
        assert 0 <= len(values[values != -1]) <= 100
Exemplo n.º 3
0
import numpy as N
from os.path import dirname

from supreme.lib import klt

import scipy as S

imread = S.misc.pilutil.imread
imsave = S.misc.pilutil.imsave

img1 = imread(dirname(__file__) + '/img0.pgm')
img2 = imread(dirname(__file__) + '/img1.pgm')

tc = klt.TrackingContext()
print tc

fl = klt.FeatureList(100)
klt.select_good_features(tc, img1, fl)

print '\nIn first image:'
print fl

imsave('feat1.ppm', fl.to_image(img1))

klt.track_features(tc, img1, img2, fl)

print '\nIn second image:\n'
print fl

imsave('feat2.ppm', fl.to_image(img2))
Exemplo n.º 4
0
import numpy as N
from os.path import dirname

from supreme.lib import klt

import scipy as S
imread = S.misc.pilutil.imread
imsave = S.misc.pilutil.imsave

img1 = imread(dirname(__file__) + '/img0.pgm')
img2 = imread(dirname(__file__) + '/img1.pgm')

tc = klt.TrackingContext()
print tc

fl = klt.FeatureList(100)
klt.select_good_features(tc, img1, fl)

print '\nIn first image:'
print fl

imsave('feat1.ppm',fl.to_image(img1))

klt.track_features(tc, img1, img2, fl)

print '\nIn second image:\n'
print fl

imsave('feat2.ppm',fl.to_image(img2))