def testReturnCopy(self): import pattern c = pattern.Circle(512, 20, (50, 50)) res = c.draw() res[:] = 0 np.testing.assert_raises(AssertionError, np.testing.assert_array_equal, res, c.output, "draw() did not return a copy!")
def testReturnCopy(self): # Checks whether the output of the pattern is a copy of the output object rather than the output object itself. import pattern c = pattern.Circle(512, 20, (50, 50)) res = c.draw() res[:] = 0 np.testing.assert_raises(AssertionError, np.testing.assert_array_equal, res, c.output, "draw() did not return a copy!")
def testPatternDifferentSize(self): # Creates an image of a circle with resolution 512x512 a radius of 20 with a center at # (50,50) and compares it to the reference image using the IoU metric import pattern c = pattern.Circle(512, 20, (50, 50)) circ = c.draw() iou = self._IoU(circ, self.reference_img2) self.assertAlmostEqual(iou, 1.0, 1)
def testPattern(self): # Creates an image of a circle with resolution 1024x1024 a radius of 200 with a center at # (512,256) and compares it to the reference image using the IoU metric import pattern c = pattern.Circle(1024, 200, (512, 256)) circ = c.draw() iou = self._IoU(circ, self.reference_img) self.assertAlmostEqual(iou, 1.0, 2)
def main(): test_checker = pattern.Checker(100, 10) test_checker.draw() test_checker.show() test_spectrum = pattern.Spectrum(255) test_spectrum.draw() test_spectrum.show() test_circle = pattern.Circle(100, 20, (50, 50)) test_circle.draw() test_circle.show()
def testPatternDifferentSize(self): import pattern c = pattern.Circle(512, 20, (50, 50)) circ = c.draw() np.testing.assert_almost_equal(circ, self.reference_img2)
def testPattern(self): import pattern c = pattern.Circle(1024, 200, (512, 256)) circ = c.draw() np.testing.assert_almost_equal(circ, self.reference_img)
import pattern import generator # Checker Board: checker = pattern.Checker(50, 5) checker.show() # Circle: circle = pattern.Circle(1000, 200, (500, 500)) circle.show() # Spectrum: spectrum = pattern.Spectrum(1000) spectrum.show() # Generator: label_path = './Labels.json' file_path = './exercise_data/' gen = generator.ImageGenerator(file_path, label_path, 15, [50, 50, 3], rotation=True, mirroring=True, shuffle=True) gen.show() gen.show()