Example #1
0
 /// <summary>
 /// Applies an adaptive threshold to an array.
 /// Source matrix must be 8-bit single-channel image.
 /// </summary>
 /// <param name="maxValue">Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.</param>
 /// <param name="adaptiveMethod">Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C .</param>
 /// <param name="thresholdType">Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .</param>
 /// <param name="blockSize">Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.</param>
 /// <param name="c">Constant subtracted from the mean or weighted mean (see the details below). 
 /// Normally, it is positive but may be zero or negative as well.</param>
 /// <returns>Destination image of the same size and the same type as src.</returns>
 public Mat AdaptiveThreshold(double maxValue, AdaptiveThresholdType adaptiveMethod, 
     ThresholdType thresholdType, int blockSize, double c)
 {
     var dst = new Mat();
     Cv2.AdaptiveThreshold(this, dst, maxValue, adaptiveMethod, 
         thresholdType, blockSize, c);
     return dst;
 }
 /// <summary>
 /// Applies an adaptive threshold to an array.
 /// </summary>
 /// <param name="src">Source 8-bit single-channel image.</param>
 /// <param name="dst">Destination image of the same size and the same type as src .</param>
 /// <param name="maxValue">Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.</param>
 /// <param name="adaptiveMethod">Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C .</param>
 /// <param name="thresholdType">Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .</param>
 /// <param name="blockSize">Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.</param>
 /// <param name="c">Constant subtracted from the mean or weighted mean (see the details below). 
 /// Normally, it is positive but may be zero or negative as well.</param>
 public static void AdaptiveThreshold(InputArray src, OutputArray dst,
     double maxValue, AdaptiveThresholdType adaptiveMethod, ThresholdType thresholdType, int blockSize, double c)
 {
     if (src == null)
         throw new ArgumentNullException("src");
     if (dst == null)
         throw new ArgumentNullException("dst");
     src.ThrowIfDisposed();
     dst.ThrowIfNotReady();
     NativeMethods.imgproc_adaptiveThreshold(src.CvPtr, dst.CvPtr, maxValue, (int)adaptiveMethod, (int)thresholdType, blockSize, c);
     dst.Fix();
 }
Example #3
0
 public static extern void cvAdaptiveThreshold(IntPtr src, IntPtr dst, double max_value, AdaptiveThresholdType adaptiveType,
     ThresholdType threshold_type, int block_size, double param1);
Example #4
0
        /// <summary>
        /// 適応的な閾値処理を行い、グレースケール画像を2値画像に変換する
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="maxValue">threshold_type がBinaryあるいはBinaryInvのときに用いる最大値</param>
        /// <param name="adaptiveMethod">適応的閾値処理で使用するアルゴリズム</param>
        /// <param name="thresholdType">閾値処理の種類. BinaryかBinaryInvのどちらか</param>
        /// <param name="blockSize">ピクセルの閾値を計算するために用いる隣接領域のサイズ: 3, 5, 7, ... </param>
        /// <param name="param1">各適応手法に応じたパラメータ. 適応手法がMeanCおよびGaussianCの場合は,平均値または重み付き平均値から引く定数. 負の値の場合もある.</param>
#else
        /// <summary>
        /// Applies adaptive threshold to array.
        /// </summary>
        /// <param name="src">Source image.</param>
        /// <param name="dst">Destination image. </param>
        /// <param name="maxValue">Maximum value that is used with Binary and BinaryInv. </param>
        /// <param name="adaptiveMethod">Adaptive thresholding algorithm to use: MeanC or GaussianC.</param>
        /// <param name="thresholdType">Thresholding type.</param>
        /// <param name="blockSize">The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, ... </param>
        /// <param name="param1">The method-dependent parameter. For the methods MeanC and GaussianC it is a constant subtracted from mean or weighted mean (see the discussion), though it may be negative. </param>
#endif
        public static void AdaptiveThreshold(CvArr src, CvArr dst, double maxValue, AdaptiveThresholdType adaptiveMethod, ThresholdType thresholdType, int blockSize, double param1)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");

            if (thresholdType != ThresholdType.Binary && thresholdType != ThresholdType.BinaryInv)
            {
                throw new ArgumentException("thresholdType == Binary || thresholdType == BinaryInv");
            }
            NativeMethods.cvAdaptiveThreshold(src.CvPtr, dst.CvPtr, maxValue, adaptiveMethod, thresholdType, blockSize, param1);
        }
Example #5
0
        /// <summary>
        /// 適応的な閾値処理を行い、グレースケール画像を2値画像に変換する
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="maxValue">threshold_type がBinaryあるいはBinaryInvのときに用いる最大値</param>
        /// <param name="adaptiveMethod">適応的閾値処理で使用するアルゴリズム</param>
        /// <param name="thresholdType">閾値処理の種類. BinaryかBinaryInvのどちらか</param>
        /// <param name="blockSize">ピクセルの閾値を計算するために用いる隣接領域のサイズ: 3, 5, 7, ... </param>
#else
        /// <summary>
        /// Applies adaptive threshold to array.
        /// </summary>
        /// <param name="src">Source image.</param>
        /// <param name="dst">Destination image. </param>
        /// <param name="maxValue">Maximum value that is used with Binary and BinaryInv. </param>
        /// <param name="adaptiveMethod">Adaptive thresholding algorithm to use: MeanC or GaussianC.</param>
        /// <param name="thresholdType">Thresholding type.</param>
        /// <param name="blockSize">The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, ... </param>
#endif
        public static void AdaptiveThreshold(CvArr src, CvArr dst, double maxValue, AdaptiveThresholdType adaptiveMethod, ThresholdType thresholdType, int blockSize)
        {
            AdaptiveThreshold(src, dst, maxValue, adaptiveMethod, thresholdType, blockSize, 5);
        }
Example #6
0
        /// <summary>
        /// 適応的な閾値処理を行い、グレースケール画像を2値画像に変換する
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="maxValue">threshold_type がBinaryあるいはBinaryInvのときに用いる最大値</param>
        /// <param name="adaptiveMethod">適応的閾値処理で使用するアルゴリズム</param>
#else
        /// <summary>
        /// Applies adaptive threshold to array.
        /// </summary>
        /// <param name="src">Source image.</param>
        /// <param name="dst">Destination image. </param>
        /// <param name="maxValue">Maximum value that is used with Binary and BinaryInv. </param>
        /// <param name="adaptiveMethod">Adaptive thresholding algorithm to use: MeanC or GaussianC.</param>
#endif
        public static void AdaptiveThreshold(CvArr src, CvArr dst, double maxValue, AdaptiveThresholdType adaptiveMethod)
        {
            AdaptiveThreshold(src, dst, maxValue, adaptiveMethod, ThresholdType.Binary, 3, 5);
        }
Example #7
0
        /// <summary>
        /// 適応的な閾値処理を行い、グレースケール画像を2値画像に変換する
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="max_value">threshold_type がBinaryあるいはBinaryInvのときに用いる最大値</param>
        /// <param name="adaptive_method">適応的閾値処理で使用するアルゴリズム</param>
        /// <param name="threshold_type">閾値処理の種類. BinaryかBinaryInvのどちらか</param>
        /// <param name="block_size">ピクセルの閾値を計算するために用いる隣接領域のサイズ: 3, 5, 7, ... </param>
        /// <param name="param1">各適応手法に応じたパラメータ. 適応手法がMeanCおよびGaussianCの場合は,平均値または重み付き平均値から引く定数. 負の値の場合もある.</param>
#else
        /// <summary>
        /// Applies adaptive threshold to array.
        /// </summary>
        /// <param name="src">Source image.</param>
        /// <param name="dst">Destination image. </param>
        /// <param name="max_value">Maximum value that is used with CV_THRESH_BINARY and CV_THRESH_BINARY_INV. </param>
        /// <param name="adaptive_method">Adaptive thresholding algorithm to use: CV_ADAPTIVE_THRESH_MEAN_C or CV_ADAPTIVE_THRESH_GAUSSIAN_C.</param>
        /// <param name="threshold_type">Thresholding type.</param>
        /// <param name="block_size">The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, ... </param>
        /// <param name="param1">The method-dependent parameter. For the methods CV_ADAPTIVE_THRESH_MEAN_C and CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a constant subtracted from mean or weighted mean (see the discussion), though it may be negative. </param>
#endif
        public static void AdaptiveThreshold(CvArr src, CvArr dst, double max_value, AdaptiveThresholdType adaptive_method, ThresholdType threshold_type, int block_size, double param1)
        {
            if (src == null)
                throw new ArgumentNullException("src");
            if (dst == null)
                throw new ArgumentNullException("dst");

            if (threshold_type != ThresholdType.Binary && threshold_type != ThresholdType.BinaryInv)
            {
                throw new ArgumentOutOfRangeException("閾値処理の種類は、BinaryかBinaryInvのどちらかである必要があります。");
            }
            CvInvoke.cvAdaptiveThreshold(src.CvPtr, dst.CvPtr, max_value, adaptive_method, threshold_type, block_size, param1);
        }
Example #8
0
        /// <summary>
        /// 適応的な閾値処理を行い、グレースケール画像を2値画像に変換する
        /// </summary>
        /// <param name="src">入力画像</param>
        /// <param name="dst">出力画像</param>
        /// <param name="max_value">threshold_type がBinaryあるいはBinaryInvのときに用いる最大値</param>
        /// <param name="adaptive_method">適応的閾値処理で使用するアルゴリズム</param>
        /// <param name="threshold_type">閾値処理の種類. BinaryかBinaryInvのどちらか</param>
        /// <param name="block_size">ピクセルの閾値を計算するために用いる隣接領域のサイズ: 3, 5, 7, ... </param>
#else
        /// <summary>
        /// Applies adaptive threshold to array.
        /// </summary>
        /// <param name="src">Source image.</param>
        /// <param name="dst">Destination image. </param>
        /// <param name="max_value">Maximum value that is used with CV_THRESH_BINARY and CV_THRESH_BINARY_INV. </param>
        /// <param name="adaptive_method">Adaptive thresholding algorithm to use: CV_ADAPTIVE_THRESH_MEAN_C or CV_ADAPTIVE_THRESH_GAUSSIAN_C.</param>
        /// <param name="threshold_type">Thresholding type.</param>
        /// <param name="block_size">The size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, ... </param>
#endif
        public static void AdaptiveThreshold(CvArr src, CvArr dst, double max_value, AdaptiveThresholdType adaptive_method, ThresholdType threshold_type, Int32 block_size)
        {
            AdaptiveThreshold(src, dst, max_value, adaptive_method, threshold_type, block_size, 5);
        }