コード例 #1
0
ファイル: test.py プロジェクト: lejeunel/imdescrip
    def test_DSIFT_patches (self):
        """ Test dense SIFT patch extraction. """

        timg = image.imread_resize(os.path.join(self.__loc__, 'test.jpg'), 200)
        patches, x, y = siftwrap.DSIFT_patches(timg, 16, 8)

        # Get an expected shapes
        self.assertTrue((patches.shape == np.array([360,128])).all()) 
        self.assertEqual(len(x), 360)
        self.assertEqual(len(y), 360)
        
        # Get reasonable range of values (bad python interface for vlfeat)
        self.assertTrue((patches != 0).any())
        self.assertTrue((patches != 255).any())
        self.assertTrue((x[0] == 7.5) and (y[0] == 7.5))
        self.assertTrue((x[-1] == 191.5) and (y[-1] == 119.5))  
コード例 #2
0
ファイル: test.py プロジェクト: lejeunel/imdescrip
    def test_imread_resize (self):
        """ Test image reader and resizer. """ 

        timg = image.imread_resize(os.path.join(self.__loc__, 'test.jpg'), 200)
        self.assertEqual(timg.shape[1], 200)
        self.assertEqual(timg.shape[0], 134)
コード例 #3
0
ファイル: test.py プロジェクト: lejeunel/imdescrip
    def test_rgb2gray (self):
        """ Test rgb 2 gray converter """

        timg = image.imread_resize(os.path.join(self.__loc__, 'test.jpg'))
        gimg = image.rgb2gray(timg)
        self.assertEqual(gimg.ndim, 2)