def testImgStandardize_3(self): filepath = './data/testimg/testimg_3.png' img = ip.imgReadAndConvert(filepath) imgs, Position = ip.projectionSegmentation(img) standard_imgs = ip.imgStandardize(imgs, Position) self.assertEqual(len(standard_imgs), 6) for i in range(len(standard_imgs)): h, w = standard_imgs[i]['segment_img'].shape[:2] self.assertEqual(h, 32) self.assertEqual(w, 32)
def testProjectionSegmentation_3(self): filepath = './data/testimg/testimg_3.png' img = ip.imgReadAndConvert(filepath) imgs, Position = ip.projectionSegmentation(img) self.assertEqual(len(imgs), 6) self.assertEqual(len(Position), 6)
def testgetHorizontalProjectionSegmentationPoints_1(self): filepath = './data/testimg/testimg_1.png' img = ip.imgReadAndConvert(filepath) H_Start, H_End = ip.getHorizontalProjectionSegmentationPoints(img) self.assertEqual(len(H_Start), 1) self.assertEqual(len(H_End), 1)
def testgetVerticalProjectionSegmentationPoints_3(self): filepath = './data/testimg/testimg_3.png' img = ip.imgReadAndConvert(filepath) W_Start, W_End = ip.getVerticalProjectionSegmentationPoints(img) self.assertEqual(len(W_Start), 1) self.assertEqual(len(W_End), 1)