How to calculate HuMoments for a contour/image in opencv using c++
hi,
i tried out the following tutorial.I used opencv 2.4.2 with visual studio 2010 and c++.(http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/moments/moments.html)
there i can calculate moments for each and every contour of the image, like this
vector<Moments> mu(contours.size() );
for( int i = 0; i < contours.size(); i++ )
{
mu[i] = moments( contours[i], false );
}
then i tried to calculate Hu-Moments in the same way. i tried with various combinations, but didn't got it work. My problems are,
- is it possible to calculate Hu-Moments only for a one contour ?
- should i calculate Hu-Moments for the whole image?
please can anyone explain this with some examples?