Пример #1
0
        /// <summary>
        ///   Computes the center moments for the specified image.
        /// </summary>
        ///
        /// <param name="image">The image whose moments should be computed.</param>
        /// <param name="area">The region of interest in the image to compute moments for.</param>
        ///
        public override void Compute(float[,] image, Rectangle area)
        {
            RawMoments     raw    = new RawMoments(image, area, Order);
            CentralMoments center = new CentralMoments(raw);

            this.Compute(center);
        }
Пример #2
0
        /// <summary>
        ///   Computes the center moments from the specified raw moments.
        /// </summary>
        ///
        /// <param name="moments">The raw moments to use as base of calculations.</param>
        ///
        public void Compute(RawMoments moments)
        {
            float x = moments.CenterX;
            float y = moments.CenterY;

            Mu00 = moments.M00;

            Mu01 = Mu10 = 0;
            Mu11 = moments.M11 - moments.M01 * x;

            Mu20 = moments.M20 - moments.M10 * x;
            Mu02 = moments.M02 - moments.M01 * y;

            Mu21 = moments.M21 - 2 * x * moments.M11 - y * moments.M20 + 2 * x * x * moments.M01;
            Mu12 = moments.M12 - 2 * y * moments.M11 - x * moments.M02 + 2 * y * y * moments.M10;

            Mu30 = moments.M30 - 3 * x * moments.M20 + 2 * x * x * moments.M10;
            Mu03 = moments.M03 - 3 * y * moments.M02 + 2 * y * y * moments.M01;

            invM00 = moments.InvM00;
        }
Пример #3
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="CentralMoments"/> class.
 /// </summary>
 ///
 /// <param name="moments">The raw moments to construct central moments.</param>
 ///
 public CentralMoments(RawMoments moments)
     : base(moments.Order)
 {
     Compute(moments);
 }