Exemplo n.º 1
0
 def extractionFeatures(self, image_path):
     try:
         self.image_path = image_path
         img = Image.open(self.image_path).convert('RGB')
         features = tas(np.asanyarray(img))
         return features
     except Exception as e:
         print(
             '\n################# (TAS) - Error in processing!  #################\n',
             e, '\n')
Exemplo n.º 2
0
    def calculate(self, resource):
        #initalizing
        except_image_only(resource)

        image_uri = resource.image
        #image_uri = BQServer().prepare_url(image_uri, remap='display')
        im = image2numpy(image_uri, remap='display')
        im = np.uint8(im)
        descriptor = tas(im)

        #initalizing rows for the table
        return descriptor
Exemplo n.º 3
0
def test_tas():
    np.random.seed(22)
    f = np.random.rand(1024, 1024)
    f = (f * 255).astype(np.uint8)
    assert np.abs(tas(f).sum()-6) < 0.0001
    assert np.abs(pftas(f).sum()-6) < 0.0001
Exemplo n.º 4
0
def test_4d():
    np.random.seed(22)
    f = np.random.rand(16,16,16,16)
    f = (f * 255).astype(np.uint8)
    tas(f)
Exemplo n.º 5
0
def test_tas():
    np.random.seed(22)
    f = np.random.rand(1024, 1024)
    f = (f * 255).astype(np.uint8)
    assert np.abs(tas(f).sum() - 6) < 0.0001
    assert np.abs(pftas(f).sum() - 6) < 0.0001
Exemplo n.º 6
0
def test_4d():
    np.random.seed(22)
    f = np.random.rand(16, 16, 16, 16)
    f = (f * 255).astype(np.uint8)
    tas(f)
Exemplo n.º 7
0
def test_4d():
    np.random.seed(22)
    f = np.random.rand(16, 16, 16, 16)
    f = (f * 255).astype(np.uint8)
    with pytest.raises(ValueError):
        tas(f)