Ejemplo n.º 1
0
        /// <summary>
        /// computes moments of the rasterized shape or a vector of points
        /// </summary>
        /// <param name="array"></param>
        /// <param name="binaryImage"></param>
        public Moments(InputArray array, bool binaryImage = false)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            array.ThrowIfDisposed();
            WCvMoments m = NativeMethods.imgproc_moments(array.CvPtr, binaryImage ? 1 : 0);

            Initialize(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates all of the moments
        /// up to the third order of a polygon or rasterized shape.
        /// </summary>
        /// <param name="array">A raster image (single-channel, 8-bit or floating-point
        /// 2D array) or an array ( 1xN or Nx1 ) of 2D points ( Point or Point2f )</param>
        /// <param name="binaryImage">If it is true, then all the non-zero image pixels are treated as 1’s</param>
        /// <returns></returns>
        private void InitializeFromInputArray(InputArray array, bool binaryImage)
        {
            WCvMoments m = NativeMethods.imgproc_moments(array.CvPtr, binaryImage ? 1 : 0);

            Initialize(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03);
        }