示例#1
0
    def test_2_centroids_on_left(self,
                                 angle_processor: AngleProcessorMiddleLine):
        centroids = [(30, 0), (40, 20)]
        angle = angle_processor.run(centroids)
        assert angle == -0.625

        centroids.reverse()
        angle = angle_processor.run(centroids)
        assert angle == -0.5
示例#2
0
    def test_2_centroids_on_left_and_right(
            self, angle_processor: AngleProcessorMiddleLine):
        centroids = [(60, 0), (100, 20)]
        angle = angle_processor.run(centroids)
        assert angle == -0.25

        centroids.reverse()
        angle = angle_processor.run(centroids)
        assert angle == 0.25
示例#3
0
    def test_middle_line_on_middle(self,
                                   angle_processor: AngleProcessorMiddleLine):
        centroids = [(75, 0)]
        angle = angle_processor.run(centroids)
        assert angle == 0.0

        centroids = [(85, 0)]
        angle = angle_processor.run(centroids)
        assert angle == 0.0
示例#4
0
 def test_middle_line_on_border_right(
         self, angle_processor: AngleProcessorMiddleLine):
     centroids = [(155, 0)]
     angle = angle_processor.run(centroids)
     assert angle == 1.0
示例#5
0
 def test_middle_line_on_right(self,
                               angle_processor: AngleProcessorMiddleLine):
     centroids = [(120, 0)]
     angle = angle_processor.run(centroids)
     assert 0.2 < angle < 0.9
示例#6
0
 def test_middle_line_on_left(self,
                              angle_processor: AngleProcessorMiddleLine):
     centroids = [(33, 0)]
     angle = angle_processor.run(centroids)
     assert -0.9 < angle < -0.2
示例#7
0
 def test_middle_line_on_border_left(
         self, angle_processor: AngleProcessorMiddleLine):
     centroids = [(2, 12)]
     assert angle_processor.run(centroids) == -1.0
示例#8
0
 def test_no_line(self, angle_processor: AngleProcessorMiddleLine):
     centroids = []
     assert angle_processor.run(centroids) == 0.0
示例#9
0
 def fixture_angle_processor(self):
     return AngleProcessorMiddleLine(image_resolution=(120, 160))