6 class moments_test(unittest.TestCase):
9 img = cvCreateMat(100,100,CV_8U);
12 # draw a rectangle in the middle
13 cvRectangle( img, cvPoint( 25, 25 ), cvPoint( 75, 75 ), CV_RGB(255,255,255), -1 );
17 # create the storage area
18 self.storage = cvCreateMemStorage (0)
21 nb_contours, self.contours = cvFindContours (img,
25 CV_CHAIN_APPROX_SIMPLE,
28 def test_cvMoments_CvMat( self ):
30 cvMoments( self.img, m, 1 )
31 def test_cvMoments_CvSeq( self ):
34 for contour in self.contours.hrange():
35 cvMoments( contour, m, 1 )
38 return unittest.TestLoader().loadTestsFromTestCase(moments_test)
40 if __name__ == '__main__':
41 unittest.TextTestRunner(verbosity=2).run(suite())