def test_min_edge(self):
        image = np.zeros(self.image_size, dtype=float)

        ix = int(np.round(float(self.image_size[1]) / 2.0))
        image[:, :ix] += 230.0
        image[:, [ix, ix + 1]] = 0.0
        image[:, ix + 2:] += 100.0

        result = _min_edge(image, 0.45, 2)
        assert_allclose(result, float(ix) + 0.5, atol=0.1)
    def test_min_edge_noisy(self):
        image = np.zeros(self.image_size, dtype=float)
        image += np.random.randint(1, 255, image.shape).astype(float)

        ix = int(np.round(float(self.image_size[1]) / 2.0))
        image[:, :ix] += np.mean(image)
        image[:, [ix, ix + 1]] = 0.0
        image[image > 255] = 255.0

        result = _min_edge(image, 0.45, 2)
        assert_allclose(result, float(ix) + 0.5, atol=0.1)