'compute humoments of contours in Emgucv

// computing hu moments
  Moments moments2=moments(croppedImage,false);
  double hu[7];
  HuMoments(moments2,hu);

this code gives the hu moment for the contours. Can any body provide the equivalent code in Emgucv C#?

partial C# code

 MCvMoments moments = contours.GetMoments();
 MCvHuMoments Humoments;
 CvInvoke.cvGetHuMoments(moments,.........);

struggling with 2nd parameter for cvGetHuMoments method.



Solution 1:[1]

Contour<Point> contours = image.FindContours();    
MCvMoments moments = contours.GetMoments();
MCvHuMoments huMoments.GetHuMoment();

The MCvHuMoments structure has fields to get hu1 to hu7.

Solution 2:[2]

MCvMoments Moments = CvInvoke.Moments(myImg);

VectorOfDouble HU_Moments = new VectorOfDouble();

CvInvoke.HuMoments(Momenti, HU_Moments);

double[] momentsD = HU_Moments.ToArray();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 krjw