def test_overlays_threshold_history_shows_threshold_and_null_lines(self):
        blackimage = np.ones((255, 255, 3), dtype='uint8') * 10
        greyimage = np.ones((255, 255, 3), dtype='uint8') * 100
        whiteimage = np.ones((255, 255, 3), dtype='uint8') * 200
        encoder = Encoder(point=[0.5, 0.5],
                          threshold=300,
                          null_zone=150,
                          history_length=10)
        for image in [
                blackimage, blackimage, blackimage, blackimage, greyimage,
                greyimage, greyimage, greyimage, whiteimage, whiteimage,
                whiteimage, whiteimage
        ]:
            encoder.process(image)
        resulting_image = encoder.overlay_history(image)
        self.assertTrue((resulting_image[255 - 10][0] == [0, 0, 255]).all())
        self.assertFalse((resulting_image[255 - 11][0] == [0, 0, 255]).all())
        self.assertTrue((resulting_image[255 - 10][1] == [0, 0, 255]).all())
        self.assertFalse((resulting_image[255 - 11][1] == [0, 0, 255]).all())

        self.assertTrue((resulting_image[255 - 100][2] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255 - 100][3] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255 - 100][4] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255 - 100][5] == [0, 255, 255]).all())
        self.assertFalse((resulting_image[255 - 101][5] == [0, 255,
                                                            255]).all())

        self.assertTrue((resulting_image[255 - 200][6] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255 - 200][7] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255 - 200][8] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255 - 200][9] == [0, 255, 0]).all())
        self.assertFalse((resulting_image[255 - 201][9] == [0, 255, 0]).all())
    def test_overlays_threshold_history_shows_threshold_and_null_lines(self):
        blackimage = np.ones((255, 255, 3), dtype='uint8') * 10
        greyimage = np.ones((255, 255, 3), dtype='uint8') * 100
        whiteimage = np.ones((255, 255, 3), dtype='uint8') * 200
        encoder = Encoder(point=[0.5, 0.5], threshold=300, null_zone=150, history_length=10)
        for image in [
                        blackimage, blackimage, blackimage, blackimage,
                        greyimage, greyimage, greyimage, greyimage,
                        whiteimage, whiteimage, whiteimage, whiteimage
                        ]:
            encoder.process(image)
        resulting_image = encoder.overlay_history(image)
        self.assertTrue((resulting_image[255-10][0] == [0, 0, 255]).all())
        self.assertFalse((resulting_image[255-11][0] == [0, 0, 255]).all())
        self.assertTrue((resulting_image[255-10][1] == [0, 0, 255]).all())
        self.assertFalse((resulting_image[255-11][1] == [0, 0, 255]).all())

        self.assertTrue((resulting_image[255-100][2] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255-100][3] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255-100][4] == [0, 255, 255]).all())
        self.assertTrue((resulting_image[255-100][5] == [0, 255, 255]).all())
        self.assertFalse((resulting_image[255-101][5] == [0, 255, 255]).all())

        self.assertTrue((resulting_image[255-200][6] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255-200][7] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255-200][8] == [0, 255, 0]).all())
        self.assertTrue((resulting_image[255-200][9] == [0, 255, 0]).all())
        self.assertFalse((resulting_image[255-201][9] == [0, 255, 0]).all())
 def test_overlay_history_shows_threshold_and_null_lines(self):
     image = np.ones((255, 255, 3), dtype='uint8') * 10
     encoder = Encoder(point=[0.5, 0.5], threshold=300, null_zone=150)
     encoder.process(image)
     resulting_image = encoder.overlay_history(image)
     self.assertTrue((resulting_image[255-150][9] == [255, 255, 255]).all())
     self.assertTrue((resulting_image[255-50][9] == [255, 255, 255]).all())
 def test_overlay_history_shows_threshold_and_null_lines(self):
     image = np.ones((255, 255, 3), dtype='uint8') * 10
     encoder = Encoder(point=[0.5, 0.5], threshold=300, null_zone=150)
     encoder.process(image)
     resulting_image = encoder.overlay_history(image)
     self.assertTrue((resulting_image[255 - 150][9] == [255, 255,
                                                        255]).all())
     self.assertTrue((resulting_image[255 - 50][9] == [255, 255,
                                                       255]).all())