当前位置: 首页>>代码示例>>C#>>正文


C# CvScalar.GetValueOrDefault方法代码示例

本文整理汇总了C#中CvScalar.GetValueOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# CvScalar.GetValueOrDefault方法的具体用法?C# CvScalar.GetValueOrDefault怎么用?C# CvScalar.GetValueOrDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CvScalar的用法示例。


在下文中一共展示了CvScalar.GetValueOrDefault方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Remap

 /// <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();
 }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:31,代码来源:Cv2_imgproc.cs

示例2: MorphologyEx

        /// <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();
        }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:40,代码来源:Cv2_imgproc.cs

示例3: Remap

        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);
        }
开发者ID:qxp1011,项目名称:opencvsharp,代码行数:16,代码来源:CvCpp.cs

示例4: WarpPerspective

        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);
        }
开发者ID:qxp1011,项目名称:opencvsharp,代码行数:14,代码来源:CvCpp.cs

示例5: MorphologyEx

        /// <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);
        }
开发者ID:qxp1011,项目名称:opencvsharp,代码行数:39,代码来源:CvCpp.cs


注:本文中的CvScalar.GetValueOrDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。