def testPatternDifferentSize(self): # Creates an RGB spectrum with resolution 100x100x3 and compares it to the reference image import pattern s = pattern.Spectrum(100) spec = s.draw() np.testing.assert_almost_equal(spec, self.reference_img2, decimal=2)
def testPattern(self): # Creates an RGB spectrum with resolution 255x255x3 and compares it to the reference image import pattern s = pattern.Spectrum(255) spec = s.draw() np.testing.assert_almost_equal(spec, self.reference_img, decimal=2)
def testReturnCopy(self): import pattern c = pattern.Spectrum(100) 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.Spectrum(100) 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 s = pattern.Spectrum(100) spec = s.draw() np.testing.assert_almost_equal(spec, self.reference_img2)
def testPattern(self): import pattern s = pattern.Spectrum(255) spec = s.draw() np.testing.assert_almost_equal(spec, 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()