Пример #1
0
        /// <summary>
        /// 配列の要素の絶対値を計算する.
        /// dst(I) = abs(src(I)).
        /// すべての配列は同じタイプ,同じサイズ(または同じROIサイズ)でなければならない.
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
#else
        /// <summary>
        /// Calculates absolute difference between array and scalar
        /// </summary>
        /// <param name="src">The source array. </param>
        /// <param name="dst">The destination array. </param>
#endif
        public static void Abs(CvArr src, CvArr dst)
        {
            if (src == null)
            {
                throw new ArgumentNullException("src");
            }
            if (dst == null)
            {
                throw new ArgumentNullException("dst");
            }
            NativeMethods.cvAbsDiffS(src.CvPtr, dst.CvPtr, CvScalar.ScalarAll(0));
        }
Пример #2
0
        public void Init(int nparams, int nerrs, CvTermCriteria criteria, bool completeSymmFlag)
        {
            if (Param != null || /*Param.Rows != nparams ||*/ nerrs != ((Err != null) ? Err.Rows : 0))
            {
                Clear();
            }

            Mask = new CvMat(nparams, 1, MatrixType.U8C1);
            Cv.Set(Mask, CvScalar.ScalarAll(1));
            PrevParam = new CvMat(nparams, 1, MatrixType.F64C1);
            Param     = new CvMat(nparams, 1, MatrixType.F64C1);
            JtJ       = new CvMat(nparams, nparams, MatrixType.F64C1);
            JtJN      = new CvMat(nparams, nparams, MatrixType.F64C1);
            JtJV      = new CvMat(nparams, nparams, MatrixType.F64C1);
            JtJW      = new CvMat(nparams, 1, MatrixType.F64C1);
            JtErr     = new CvMat(nparams, 1, MatrixType.F64C1);
            if (nerrs > 0)
            {
                J   = new CvMat(nerrs, nparams, MatrixType.F64C1);
                Err = new CvMat(nerrs, 1, MatrixType.F64C1);
            }
            PrevErrNorm = double.MaxValue;
            LambdaLg10  = -3;
            Criteria    = criteria;
            if ((criteria.Type & CriteriaType.Iteration) == CriteriaType.Iteration)
            {
                criteria.MaxIter = Math.Min(Math.Max(criteria.MaxIter, 1), 1000);
            }
            else
            {
                criteria.MaxIter = 30;
            }
            if ((criteria.Type & CriteriaType.Epsilon) == CriteriaType.Epsilon)
            {
                criteria.Epsilon = Math.Max(criteria.Epsilon, 0);
            }
            else
            {
                criteria.Epsilon = double.Epsilon;
            }
            State            = LevMarqState.Started;
            Iters            = 0;
            CompleteSymmFlag = completeSymmFlag;
        }
Пример #3
0
        /// <summary>
        /// 配列の要素の絶対値を計算する.
        /// dst(I) = abs(src(I)).
        /// すべての配列は同じタイプ,同じサイズ(または同じROIサイズ)でなければならない.
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
#else
        /// <summary>
        /// Calculates absolute difference between array and scalar
        /// </summary>
        /// <param name="src">The source array. </param>
        /// <param name="dst">The destination array. </param>
#endif
        public static void Abs(CvArr src, CvArr dst)
        {
            AbsDiffS(src, dst, CvScalar.ScalarAll(0));
        }
Пример #4
0
        /// <summary>
        /// 画像のアフィン変換を行う
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="mapMatrix">2×3 変換行列</param>
        /// <param name="flags">補間方法</param>
#else
        /// <summary>
        /// Applies affine transformation to the image.
        /// </summary>
        /// <param name="src">Source image. </param>
        /// <param name="dst">Destination image. </param>
        /// <param name="mapMatrix">2x3 transformation matrix. </param>
        /// <param name="flags">A combination of interpolation method and the optional flags.</param>
#endif
        public static void WarpAffine(CvArr src, CvArr dst, CvMat mapMatrix, Interpolation flags)
        {
            WarpAffine(src, dst, mapMatrix, flags, CvScalar.ScalarAll(0));
        }
Пример #5
0
        /// <summary>
        /// 画像のアフィン変換を行う
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="mapMatrix">2×3 変換行列</param>
#else
        /// <summary>
        /// Applies affine transformation to the image.
        /// </summary>
        /// <param name="src">Source image. </param>
        /// <param name="dst">Destination image. </param>
        /// <param name="mapMatrix">2x3 transformation matrix. </param>
#endif
        public static void WarpAffine(CvArr src, CvArr dst, CvMat mapMatrix)
        {
            WarpAffine(src, dst, mapMatrix, Interpolation.Linear | Interpolation.FillOutliers, CvScalar.ScalarAll(0));
        }
Пример #6
0
        /// <summary>
        /// 画像上にテキストを描画する際に利用されるフォントを作成します.
        /// </summary>
        /// <param name="nameFont">フォント名. 指定のフォントが見つからなければ,デフォルトフォントが利用されます.</param>
        /// <param name="pointSize">ォントサイズ.これが,未指定,または0以下の値の場合,フォンとのポイントサイズはシステム依存のデフォルト値にセットされます.通常は,12ポイントです.</param>
#else
        /// <summary>
        /// Create the font to be used to draw text on an image
        /// </summary>
        /// <param name="nameFont">Name of the font. The name should match the name of a system font (such as ``Times’‘). If the font is not found, a default one will be used.</param>
        /// <param name="pointSize">Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.</param>
#endif
        public CvFontQt(string nameFont, int pointSize)
            : this(nameFont, pointSize, CvScalar.ScalarAll(0), FontWeight.Normal, FontStyle.Normal, 0)
        {
        }
Пример #7
0
        /// <summary>
        /// 画像上にテキストを描画する際に利用されるフォントを作成します.
        /// </summary>
        /// <param name="nameFont">フォント名. 指定のフォントが見つからなければ,デフォルトフォントが利用されます.</param>
#else
        /// <summary>
        /// Create the font to be used to draw text on an image
        /// </summary>
        /// <param name="nameFont">Name of the font. The name should match the name of a system font (such as ``Times’‘). If the font is not found, a default one will be used.</param>
#endif
        public CvFontQt(string nameFont)
            : this(nameFont, -1, CvScalar.ScalarAll(0), FontWeight.Normal, FontStyle.Normal, 0)
        {
        }