Exemplo n.º 1
0
    def test_upsample_1000(self):
        img0 = scipy.misc.lena()
        ny, nx = img0.shape
        row_shift = (rand() - 0.5)*ny
        col_shift = (rand() - 0.5)*nx
        img1 = mm.circshift(img0, (row_shift, col_shift))

        val, row, col = mm.register(img0, img1, upsample=105)
        self.assertAlmostEqual(row, row_shift, places=2)
        self.assertAlmostEqual(col, col_shift, places=2)
Exemplo n.º 2
0
    def test_upsample_1000(self):
        img0 = scipy.misc.lena()
        ny, nx = img0.shape
        row_shift = (rand() - 0.5) * ny
        col_shift = (rand() - 0.5) * nx
        img1 = mm.circshift(img0, (row_shift, col_shift))

        val, row, col = mm.register(img0, img1, upsample=105)
        self.assertAlmostEqual(row, row_shift, places=2)
        self.assertAlmostEqual(col, col_shift, places=2)
Exemplo n.º 3
0
    def test_normalization(self):
        img0 = zeros([30, 30])
        img0[0, 0] = 2.0
        img0[0, 1] = 4.0
        ny, nx = img0.shape
        row_shift = 3
        col_shift = 5
        img1 = zeros([30, 30])
        img1[3, 3] = 2.0
        img1[3, 4] = 4.0
        
        v, y, x = mm.register(img0, img1)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, 0.5*img1)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, img1, upsample=4)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, 0.5*img1, upsample=4)
        self.assertAlmostEqual(v, 1, places=8)
Exemplo n.º 4
0
    def test_normalization(self):
        img0 = zeros([30, 30])
        img0[0, 0] = 2.0
        img0[0, 1] = 4.0
        ny, nx = img0.shape
        row_shift = 3
        col_shift = 5
        img1 = zeros([30, 30])
        img1[3, 3] = 2.0
        img1[3, 4] = 4.0

        v, y, x = mm.register(img0, img1)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, 0.5 * img1)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, img1, upsample=4)
        self.assertAlmostEqual(v, 1, places=8)

        v, y, x = mm.register(img0, 0.5 * img1, upsample=4)
        self.assertAlmostEqual(v, 1, places=8)
Exemplo n.º 5
0
    def test_upsample_1(self):
        """Test algorithm without subpixel registration."""

        img0 = scipy.misc.lena()
        ny, nx = img0.shape
        row_shift = randint(-ny/2, ny/2)
        col_shift = randint(-nx/2, nx/2)
        row_shift = 10
        col_shift = 27
        img1 = mm.circshift(img0, (row_shift, col_shift))
        img1 = abs(img1)

        if PLOTTING:
            subplot(211)
            imshow(img0)
            title('original')
            subplot(212)
            imshow(img1)
            title('shifted by {}x{}'.format(row_shift, col_shift))
            show()

        val, row, col = mm.register(img0, img1)
        self.assertEqual(row, row_shift)
        self.assertEqual(col, col_shift)
Exemplo n.º 6
0
    def test_upsample_1(self):
        """Test algorithm without subpixel registration."""

        img0 = scipy.misc.lena()
        ny, nx = img0.shape
        row_shift = randint(-ny / 2, ny / 2)
        col_shift = randint(-nx / 2, nx / 2)
        row_shift = 10
        col_shift = 27
        img1 = mm.circshift(img0, (row_shift, col_shift))
        img1 = abs(img1)

        if PLOTTING:
            subplot(211)
            imshow(img0)
            title('original')
            subplot(212)
            imshow(img1)
            title('shifted by {}x{}'.format(row_shift, col_shift))
            show()

        val, row, col = mm.register(img0, img1)
        self.assertEqual(row, row_shift)
        self.assertEqual(col, col_shift)