Friday, 15 February 2013

Colour: Implementing Image Moment for Tracking

Image moment is a weighted average of pixels intensities. Image moment could give useful properties for image analysis like area, centroid and also the image orientaion.
In OpenCV the following function is used to calculate moment;

  CvMoments *moment = (CvMoments*)malloc(sizeof(CvMoments));
        cvMoments(img, moment, 1); 
 
  
To get the exact location of the object or the centroid can be obtained by dividing the moment value with the area.The area can be obtained by applying the following function;

  cvGetCentralMoment()

No comments:

Post a Comment