test_locator.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:sldc 作者: waliens 项目源码 文件源码
def testLocator(self):
        image = mk_img(400, 600)

        # draw a rectangle
        A = (5, 80)
        B = (5, 300)
        C = (250, 80)
        D = (250, 300)
        ABCD = Polygon([A, B, D, C, A])
        image = draw_poly(image, ABCD)
        image, circle = draw_circle(image, 85, (500, 300), return_circle=True)

        # test locator
        locator = BinaryLocator()
        located = locator.locate(image)
        polygons, labels = zip(*located)

        self.assertEqual(2, len(polygons), "Two polygons found")
        self.assertTrue(ABCD.equals(polygons[1]), "Rectangle polygon is found")

        self.assertLessEqual(relative_error(polygons[0].area, np.pi * 85 * 85), 0.005)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号