def test_simple(self): rgbim = numpy.zeros((512, 256, 3), dtype=numpy.uint8) rgbim = model.DataArray(rgbim) gsim = img.RGB2Greyscale(rgbim) self.assertEqual(gsim.shape, rgbim.shape[0:2]) numpy.testing.assert_array_equal(gsim, rgbim[:, :, 0]) rgbim[1, 1, 1] = 254 gsim = img.RGB2Greyscale(rgbim) self.assertEqual(gsim.shape, rgbim.shape[0:2]) self.assertEqual(gsim[1, 1], 254)
def test_find_lens_center(self): """ Test FindRingCenter for lenses """ data = hdf5.read_data(os.path.join(TEST_IMAGE_PATH, "navcam-calib2.h5")) imgs = img.RGB2Greyscale(img.ensureYXC(data[0])) # lens_coordinates = delphi.FindCircleCenter(data[0][0], delphi.LENS_RADIUS, 5) # expected_coordinates = (-5.9703947e-05, 1.5257675e-04) # (451.5, 445.5) px lens_coordinates = delphi.FindRingCenter(imgs) expected_coordinates = (-1.6584835e-05, 1.3084411e-04) # 454.75, 446.1) px numpy.testing.assert_almost_equal(lens_coordinates, expected_coordinates)