Esempio n. 1
0
    def testShowPocketValues(self):
        p = pockets(offsetPoint, emptyImageList)
        color = (0, 0, 255)

        bigImage = numpy.zeros((pocketSize * 10, pocketSize * 10, 3),
                               numpy.float32)
        p.ShowPocketValues(color, bigImage)
Esempio n. 2
0
 def testPockets(self):
     p = pockets(offsetPoint, emptyImageList)
     self.assertEqual(p.pointTopLeft, offsetPoint)
     self.assertEqual(
         p.pointBottomRight,
         offsetPoint + 7 * point(pocketSize, pocketSize) - point(1, 1))
     pass
Esempio n. 3
0
 def testShowPocketBoundaries(self):
     p = pockets( offsetPoint, emptyImageList )
     color = (0, 0, 255)
     
     bigImage = numpy.zeros((pocketSize*10, pocketSize*10, 3), numpy.float32)
     p.ShowPocketBoundaries( color, bigImage )
     
     # yes, x and y are inverted...
     self.assertEqual( bigImage[ offsetPoint.y, offsetPoint.x ][0], color[0] )
     self.assertEqual( bigImage[ offsetPoint.y, offsetPoint.x ][1], color[1] )
     self.assertEqual( bigImage[ offsetPoint.y, offsetPoint.x ][2], color[2] )
Esempio n. 4
0
    def testShowPocketBoundaries(self):
        p = pockets(offsetPoint, emptyImageList)
        color = (0, 0, 255)

        bigImage = numpy.zeros((pocketSize * 10, pocketSize * 10, 3),
                               numpy.float32)
        p.ShowPocketBoundaries(color, bigImage)

        # yes, x and y are inverted...
        self.assertEqual(bigImage[offsetPoint.y, offsetPoint.x][0], color[0])
        self.assertEqual(bigImage[offsetPoint.y, offsetPoint.x][1], color[1])
        self.assertEqual(bigImage[offsetPoint.y, offsetPoint.x][2], color[2])
Esempio n. 5
0
 def testGetSetValue(self):
     p = pockets( offsetPoint, emptyImageList )
     self.assertTrue( p.processImage( bigBlackImage ) )
     p.setValue(2,2, 'X')
     self.assertEqual( p.getValue( 2, 2 ), 'X' )
Esempio n. 6
0
 def testShowPocketValues(self):
     p = pockets( offsetPoint, emptyImageList )
     color = (0, 0, 255)
     
     bigImage = numpy.zeros((pocketSize*10, pocketSize*10, 3), numpy.float32)
     p.ShowPocketValues( color, bigImage )
Esempio n. 7
0
 def testGetImage(self):
     p = pockets( offsetPoint, emptyImageList )
     self.assertTrue( p.processImage( bigBlackImage ) )
     self.assertTrue( numpy.array_equal( p.getImage(2,2), smallBlackImage ) )
Esempio n. 8
0
 def testGetContent(self):
     p = pockets( offsetPoint, emptyImageList )
     self.assertTrue( p.processImage( bigBlackImage ) )
     self.assertTrue( p.isEmpty(2,2) )        
Esempio n. 9
0
 def testPockets(self):
     p = pockets( offsetPoint, emptyImageList )
     self.assertEqual( p.pointTopLeft, offsetPoint )
     self.assertEqual( p.pointBottomRight, offsetPoint+7*point(pocketSize, pocketSize) - point( 1, 1 ) )    
     pass
Esempio n. 10
0
    CornerTL = FindCorner( image, screwtemplateTL )
    CornerBR = FindCorner( image, screwtemplateBR )
    size = CornerBR -CornerTL

    # TODO: magic values!
    DropItemsAreaTL = CornerTL + point(15,95)
    DropItemsAreaBR = DropItemsAreaTL + point( 281, 80 )

    ScoreBoardOffset = point( 71, 34 ) # scoreboard relative to screw
    curScoreBoard = ScoreBoard( CornerTL + ScoreBoardOffset, digits)
    CurScore = curScoreBoard.ReadScore(image)

    # red squares in matrix
    offset = point( DropItemsAreaTL.x, DropItemsAreaBR.y )

    curPockets = pockets( offset, emptyImageList )
    curPockets.processImage(image)
    
    fileno = fileno + 1
    emptycount = 0
    unknownCount = 0

    # draw pockets 
    for col in range(0,7):
        for row in range(0,7):
            if curPockets.isEmpty(col, row):
                emptycount += 1
                curPockets.setValue(col, row, 'X')
                continue
            
            item = items.findItem( curPockets.getImage(col, row))
Esempio n. 11
0
 def testGetSetValue(self):
     p = pockets(offsetPoint, emptyImageList)
     self.assertTrue(p.processImage(bigBlackImage))
     p.setValue(2, 2, 'X')
     self.assertEqual(p.getValue(2, 2), 'X')
Esempio n. 12
0
 def testGetImage(self):
     p = pockets(offsetPoint, emptyImageList)
     self.assertTrue(p.processImage(bigBlackImage))
     self.assertTrue(numpy.array_equal(p.getImage(2, 2), smallBlackImage))
Esempio n. 13
0
 def testGetContent(self):
     p = pockets(offsetPoint, emptyImageList)
     self.assertTrue(p.processImage(bigBlackImage))
     self.assertTrue(p.isEmpty(2, 2))