/// <summary>
 /// Applies a generic geometrical transformation to an image.
 /// </summary>
 /// <param name="src">Source image.</param>
 /// <param name="dst">Destination image. It has the same size as map1 and the same type as src</param>
 /// <param name="map1">The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.</param>
 /// <param name="map2">The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.</param>
 /// <param name="interpolation">Interpolation method. The method INTER_AREA is not supported by this function.</param>
 /// <param name="borderMode">Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, 
 /// it means that the pixels in the destination image that corresponds to the "outliers" in 
 /// the source image are not modified by the function.</param>
 /// <param name="borderValue">Value used in case of a constant border. By default, it is 0.</param>
 public static void Remap(InputArray src, OutputArray dst, InputArray map1, InputArray map2,
     Interpolation interpolation = Interpolation.Linear, BorderType borderMode = BorderType.Constant, CvScalar? borderValue = null)
 {
     if (src == null)
         throw new ArgumentNullException("src");
     if (dst == null)
         throw new ArgumentNullException("dst");
     if (map1 == null)
         throw new ArgumentNullException("map1");
     if (map2 == null)
         throw new ArgumentNullException("map2");
     src.ThrowIfDisposed();
     dst.ThrowIfNotReady();
     map1.ThrowIfDisposed();
     map2.ThrowIfDisposed();
     CvScalar borderValue0 = borderValue.GetValueOrDefault(CvScalar.ScalarAll(0));
     NativeMethods.imgproc_remap(src.CvPtr, dst.CvPtr, map1.CvPtr, map2.CvPtr, (int)interpolation, (int)borderMode, borderValue0);
     dst.Fix();
 }
        /// <summary>
        /// 高度なモルフォロジー変換を行います.
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">src と同じサイズ,同じ型の出力画像</param>
        /// <param name="op">モルフォロジー演算の種類</param>
        /// <param name="element">構造要素</param>
        /// <param name="anchor">構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します.</param>
        /// <param name="iterations">収縮と膨張が適用される回数. [既定値は1]</param>
        /// <param name="borderType">ピクセル外挿手法. [既定値はBorderType.Constant]</param>
        /// <param name="borderValue">定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()]</param>
#else
        /// <summary>
        /// Performs advanced morphological transformations
        /// </summary>
        /// <param name="src">Source image</param>
        /// <param name="dst">Destination image. It will have the same size and the same type as src</param>
        /// <param name="op">Type of morphological operation</param>
        /// <param name="element">Structuring element</param>
        /// <param name="anchor">Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center</param>
        /// <param name="iterations">Number of times erosion and dilation are applied. [By default this is 1]</param>
        /// <param name="borderType">The pixel extrapolation method. [By default this is BorderType.Constant]</param>
        /// <param name="borderValue">The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]</param>
#endif
        public static void MorphologyEx(InputArray src, OutputArray dst, MorphologyOperation op, InputArray element,
            CvPoint? anchor = null, int iterations = 1, BorderType borderType = BorderType.Constant, CvScalar? borderValue = null)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            src.ThrowIfDisposed();
            dst.ThrowIfNotReady();

            CvPoint anchor0 = anchor.GetValueOrDefault(new CvPoint(-1, -1));
            CvScalar borderValue0 = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue());
            IntPtr elementPtr = ToPtr(element);
            NativeMethods.imgproc_morphologyEx(src.CvPtr, dst.CvPtr, (int)op, elementPtr, anchor0, iterations, (int)borderType, borderValue0);
            dst.Fix();
        }
Beispiel #3
0
        public static void Remap(Mat src, Mat dst, Mat map1, Mat map2,
            Interpolation interpolation = Interpolation.Linear, BorderType borderMode = BorderType.Constant, CvScalar? borderValue = null)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (map1 == null)
                throw new ArgumentNullException("map1");
            if (map2 == null)
                throw new ArgumentNullException("map2");

            CvScalar _borderValue = borderValue.GetValueOrDefault(CvScalar.ScalarAll(0));

            CppInvoke.cv_remap(src.CvPtr, dst.CvPtr, map1.CvPtr, map2.CvPtr, interpolation, borderMode, _borderValue);
        }
Beispiel #4
0
        public static void WarpPerspective(Mat src, Mat dst, Mat M, CvSize dsize,
            Interpolation flags = Interpolation.Linear, BorderType borderMode = BorderType.Constant, CvScalar? borderValue = null)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (M == null)
                throw new ArgumentNullException("M");

            CvScalar _borderValue = borderValue.GetValueOrDefault(CvScalar.ScalarAll(0));

            CppInvoke.cv_warpPerspective(src.CvPtr, dst.CvPtr, M.CvPtr, dsize, flags, borderMode, _borderValue);
        }
Beispiel #5
0
        /// <summary>
        /// 高度なモルフォロジー変換を行います.
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">src と同じサイズ,同じ型の出力画像</param>
        /// <param name="op">モルフォロジー演算の種類</param>
        /// <param name="element">構造要素</param>
        /// <param name="anchor">構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します.</param>
        /// <param name="iterations">収縮と膨張が適用される回数. [既定値は1]</param>
        /// <param name="borderType">ピクセル外挿手法. [既定値はBorderType.Constant]</param>
        /// <param name="borderValue">定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()]</param>
#else
        /// <summary>
        /// Performs advanced morphological transformations
        /// </summary>
        /// <param name="src">Source image</param>
        /// <param name="dst">Destination image. It will have the same size and the same type as src</param>
        /// <param name="op">Type of morphological operation</param>
        /// <param name="element">Structuring element</param>
        /// <param name="anchor">Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center</param>
        /// <param name="iterations">Number of times erosion and dilation are applied. [By default this is 1]</param>
        /// <param name="borderType">The pixel extrapolation method. [By default this is BorderType.Constant]</param>
        /// <param name="borderValue">The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]</param>
#endif
        public static void MorphologyEx(Mat src, Mat dst, MorphologyOperation op, Mat element,
            CvPoint? anchor = null, int iterations = 1, BorderType borderType = BorderType.Constant, CvScalar? borderValue = null)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");
            if (element == null)
                throw new ArgumentNullException("element");

            CvPoint _anchor = anchor.GetValueOrDefault(new CvPoint(-1, -1));
            CvScalar _borderValue = borderValue.GetValueOrDefault(MorphologyDefaultBorderValue());

            CppInvoke.cv_morphologyEx(src.CvPtr, dst.CvPtr, op, element.CvPtr, _anchor, iterations, borderType, _borderValue);
        }