Example #1
0
 def test_eq(self):
     """.__eq__"""
     r1 = roi.ROI((10, 12), (35, 40))
     r2 = roi.ROI(r1.top_left, r1.bottom_right)
     assert r1 == r2
     r3 = roi.ROI(r1.top_left, (150, 160))
     assert r1 != r3
     r4 = roi.ROI((100, 110), r1.bottom_right)
Example #2
0
    def test_init(self):
        """.__init__"""
        np.testing.assert_equal(self.roi.top_left, self.top_left)
        np.testing.assert_equal(self.roi.bottom_right, self.bottom_right)

        r = roi.ROI(self.top_left,
                    size=tuple(
                        b - t
                        for t, b in zip(self.top_left, self.bottom_right)))
        self.assert_roi_equal(r, self.roi)
Example #3
0
    def setUp(self):
        self.top_left = (20, 10)
        self.bottom_right = (90, 70)
        self.roi = roi.ROI(self.top_left, self.bottom_right)

        self.img = np.zeros((100, 130))
        self.img[self.top_left[1]:self.bottom_right[1],
                 self.top_left[0]:self.bottom_right[0]] = 1
        self.cropped_img = self.img[self.top_left[1]:self.bottom_right[1],
                                    self.top_left[0]:self.bottom_right[0]]

        self.loc = pd.DataFrame(
            [[-80, -80], [3, 3], [30, 30], [100, 80], [1000, 1000]],
            columns=["x", "y"])
        self.loc_roi = self.loc.iloc[[2]].copy()
        self.loc_roi_inv = self.loc.drop(2).copy()