Esempio n. 1
0
 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!")
Esempio n. 2
0
 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!")
Esempio n. 3
0
 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)
Esempio n. 4
0
    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)
Esempio n. 5
0
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()
Esempio n. 6
0
 def testPatternDifferentSize(self):
     import pattern
     c = pattern.Circle(512, 20, (50, 50))
     circ = c.draw()
     np.testing.assert_almost_equal(circ, self.reference_img2)
Esempio n. 7
0
 def testPattern(self):
     import pattern
     c = pattern.Circle(1024, 200, (512, 256))
     circ = c.draw()
     np.testing.assert_almost_equal(circ, self.reference_img)
Esempio n. 8
0
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()