def testPatternDifferentSize(self): # Creates a checkerboard pattern with resolution 100x100 and a tile_size of 25 and compares it to the reference image import pattern c = pattern.Checker(100, 25) c.draw() np.testing.assert_almost_equal(c.output, self.reference_img2)
def testReturnCopy(self): import pattern c = pattern.Checker(100, 25) 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.Checker(100, 25) 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 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.Checker(100, 25) c.draw() np.testing.assert_almost_equal(c.output, self.reference_img2)
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()