Exemple #1
1
        /// <summary>
        /// ハフ変換を用いて,グレースケール画像から円を検出します.
        /// </summary>
        /// <param name="image">8ビット,シングルチャンネル,グレースケールの入力画像></param>
        /// <param name="method">現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている.</param>
        /// <param name="dp">画像分解能に対する投票分解能の比率の逆数.</param>
        /// <param name="minDist">検出される円の中心同士の最小距離.</param>
        /// <param name="param1">手法依存の1番目のパラメータ.[既定値は100]</param>
        /// <param name="param2">手法依存の2番目のパラメータ.[既定値は100]</param>
        /// <param name="minRadius">円の半径の最小値 [既定値は0]</param>
        /// <param name="maxRadius">円の半径の最大値 [既定値は0]</param>
        /// <returns>検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます</returns>
#else
        /// <summary>
        /// Finds circles in a grayscale image using a Hough transform.
        /// </summary>
        /// <param name="image">The 8-bit, single-channel, grayscale input image</param>
        /// <param name="method">Currently, the only implemented method is HoughCirclesMethod.Gradient</param>
        /// <param name="dp">The inverse ratio of the accumulator resolution to the image resolution. </param>
        /// <param name="minDist">Minimum distance between the centers of the detected circles. </param>
        /// <param name="param1">The first method-specific parameter. [By default this is 100]</param>
        /// <param name="param2">The second method-specific parameter. [By default this is 100]</param>
        /// <param name="minRadius">Minimum circle radius. [By default this is 0]</param>
        /// <param name="maxRadius">Maximum circle radius. [By default this is 0] </param>
        /// <returns>The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)</returns>
#endif
        public static CvCircleSegment[] HoughCircles(this Mat image, HoughCirclesMethod method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            using (StdVectorVec3f vec = new StdVectorVec3f())
            {
                CppInvoke.cv_HoughCircles(image.CvPtr, vec.CvPtr, method, dp, minDist, param1, param2, minRadius, maxRadius);
                return vec.ToArray<CvCircleSegment>();
            }
        }
Exemple #2
0
 internal static extern Seq cvHoughCircles(
     Arr image,
     CVHandle circle_storage,
     HoughCirclesMethod method,
     double dp,
     double min_dist,
     double param1,
     double param2,
     int min_radius,
     int max_radius);
Exemple #3
0
    /// <summary>
    /// ハフ変換を用いて,グレースケール画像から円を検出します.
    /// </summary>
    /// <param name="method">現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている.</param>
    /// <param name="dp">画像分解能に対する投票分解能の比率の逆数.</param>
    /// <param name="minDist">検出される円の中心同士の最小距離.</param>
    /// <param name="param1">手法依存の1番目のパラメータ.[既定値は100]</param>
    /// <param name="param2">手法依存の2番目のパラメータ.[既定値は100]</param>
    /// <param name="minRadius">円の半径の最小値 [既定値は0]</param>
    /// <param name="maxRadius">円の半径の最大値 [既定値は0]</param>
    /// <returns>検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます</returns>
#else
        /// <summary>
        /// Finds circles in a grayscale image using a Hough transform.
        /// The input matrix must be 8-bit, single-channel and grayscale.
        /// </summary>
        /// <param name="method">Currently, the only implemented method is HoughCirclesMethod.Gradient</param>
        /// <param name="dp">The inverse ratio of the accumulator resolution to the image resolution. </param>
        /// <param name="minDist">Minimum distance between the centers of the detected circles. </param>
        /// <param name="param1">The first method-specific parameter. [By default this is 100]</param>
        /// <param name="param2">The second method-specific parameter. [By default this is 100]</param>
        /// <param name="minRadius">Minimum circle radius. [By default this is 0]</param>
        /// <param name="maxRadius">Maximum circle radius. [By default this is 0] </param>
        /// <returns>The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)</returns>
#endif
        public CvCircleSegment[] HoughCircles(HoughCirclesMethod method, double dp, double minDist,
            double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
        {
            return Cv2.HoughCircles(this, method, dp, minDist, param1, param2, minRadius, maxRadius);
        }
Exemple #4
0
 public static extern IntPtr cvHoughCircles(IntPtr image, IntPtr circle_storage, HoughCirclesMethod method, double dp, double min_dist,
     double param1, double param2, int min_radius, int max_radius);
Exemple #5
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param>
        /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param>
        /// <param name="minRadius">検出すべき円の最小半径.</param>
        /// <param name="maxRadius">検出すべき円の最大半径 デフォルトの最大半径は max(image_width, image_height) にセットされている.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <param name="param1">The first method-specific parameter. In case of CV_HOUGH_GRADIENT it is the higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller). </param>
        /// <param name="param2">The second method-specific parameter. In case of CV_HOUGH_GRADIENT it is accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. </param>
        /// <param name="minRadius">Minimal radius of the circles to search for. </param>
        /// <param name="maxRadius">Maximal radius of the circles to search for. By default the maximal radius is set to max(image_width, image_height). </param>
        /// <returns></returns>
#endif
        public static CvSeq <CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }
            if (circleStorage == null)
            {
                throw new ArgumentNullException("circleStorage");
            }
            IntPtr result = NativeMethods.cvHoughCircles(image.CvPtr, circleStorage.CvPtr, method, dp, minDist, param1, param2, minRadius, maxRadius);

            if (result == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                return(new CvSeq <CvCircleSegment>(result));
            }
        }
Exemple #6
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param>
        /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param>
        /// <param name="minRadius">検出すべき円の最小半径.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <param name="param1">The first method-specific parameter. In case of CV_HOUGH_GRADIENT it is the higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller). </param>
        /// <param name="param2">The second method-specific parameter. In case of CV_HOUGH_GRADIENT it is accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. </param>
        /// <param name="minRadius">Minimal radius of the circles to search for. </param>
        /// <returns></returns>
#endif
        public static CvSeq <CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist, double param1, double param2, int minRadius)
        {
            return(HoughCircles(image, circleStorage, method, dp, minDist, param1, param2, minRadius, 0));
        }
Exemple #7
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <returns></returns>
#endif
        public static CvSeq <CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist)
        {
            return(HoughCircles(image, circleStorage, method, dp, minDist, 100, 100, 0, 0));
        }
        /// <summary>
        /// ハフ変換を用いて,グレースケール画像から円を検出します.
        /// </summary>
        /// <param name="image">8ビット,シングルチャンネル,グレースケールの入力画像></param>
        /// <param name="method">現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている.</param>
        /// <param name="dp">画像分解能に対する投票分解能の比率の逆数.</param>
        /// <param name="minDist">検出される円の中心同士の最小距離.</param>
        /// <param name="param1">手法依存の1番目のパラメータ.[既定値は100]</param>
        /// <param name="param2">手法依存の2番目のパラメータ.[既定値は100]</param>
        /// <param name="minRadius">円の半径の最小値 [既定値は0]</param>
        /// <param name="maxRadius">円の半径の最大値 [既定値は0]</param>
        /// <returns>検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます</returns>
#else
        /// <summary>
        /// Finds circles in a grayscale image using a Hough transform.
        /// </summary>
        /// <param name="image">The 8-bit, single-channel, grayscale input image</param>
        /// <param name="method">Currently, the only implemented method is HoughCirclesMethod.Gradient</param>
        /// <param name="dp">The inverse ratio of the accumulator resolution to the image resolution. </param>
        /// <param name="minDist">Minimum distance between the centers of the detected circles. </param>
        /// <param name="param1">The first method-specific parameter. [By default this is 100]</param>
        /// <param name="param2">The second method-specific parameter. [By default this is 100]</param>
        /// <param name="minRadius">Minimum circle radius. [By default this is 0]</param>
        /// <param name="maxRadius">Maximum circle radius. [By default this is 0] </param>
        /// <returns>The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)</returns>
#endif
        public static CvCircleSegment[] HoughCircles(InputArray image, HoughCirclesMethod method, double dp, double minDist, 
            double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
        {
            if (image == null)
                throw new ArgumentNullException("image");
            image.ThrowIfDisposed();
            using (var vec = new VectorOfVec3f())
            {
                NativeMethods.imgproc_HoughCircles(image.CvPtr, vec.CvPtr, (int)method, dp, minDist, param1, param2, minRadius, maxRadius);
                return vec.ToArray<CvCircleSegment>();
            }
        }
Exemple #9
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param>
        /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param>
        /// <param name="minRadius">検出すべき円の最小半径.</param>
        /// <param name="maxRadius">検出すべき円の最大半径 デフォルトの最大半径は max(image_width, image_height) にセットされている.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <param name="param1">The first method-specific parameter. In case of CV_HOUGH_GRADIENT it is the higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller). </param>
        /// <param name="param2">The second method-specific parameter. In case of CV_HOUGH_GRADIENT it is accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. </param>
        /// <param name="minRadius">Minimal radius of the circles to search for. </param>
        /// <param name="maxRadius">Maximal radius of the circles to search for. By default the maximal radius is set to max(image_width, image_height). </param>
        /// <returns></returns>
#endif
        public static CvSeq<CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist, double param1, double param2, int minRadius, int maxRadius)
        {
            if (image == null)
                throw new ArgumentNullException("image");
            if (circleStorage == null)
                throw new ArgumentNullException("circleStorage");
            IntPtr result = NativeMethods.cvHoughCircles(image.CvPtr, circleStorage.CvPtr, method, dp, minDist, param1, param2, minRadius, maxRadius);
            if (result == IntPtr.Zero)
                return null;
            else
                return new CvSeq<CvCircleSegment>(result);
        }
Exemple #10
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param>
        /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param>
        /// <param name="minRadius">検出すべき円の最小半径.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <param name="param1">The first method-specific parameter. In case of CV_HOUGH_GRADIENT it is the higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller). </param>
        /// <param name="param2">The second method-specific parameter. In case of CV_HOUGH_GRADIENT it is accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. </param>
        /// <param name="minRadius">Minimal radius of the circles to search for. </param>
        /// <returns></returns>
#endif
        public static CvSeq<CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist, double param1, double param2, int minRadius)
        {
            return HoughCircles(image, circleStorage, method, dp, minDist, param1, param2, minRadius, 0);
        }
Exemple #11
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circleStorage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="minDist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circleStorage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="minDist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <returns></returns>
#endif
        public static CvSeq<CvCircleSegment> HoughCircles(CvArr image, CvMat circleStorage, HoughCirclesMethod method, double dp, double minDist)
        {
            return HoughCircles(image, circleStorage, method, dp, minDist, 100, 100, 0, 0);
        }
Exemple #12
0
        /// <summary>
        /// ハフ変換を用いて,グレースケール画像から円を検出します.
        /// </summary>
        /// <param name="image">8ビット,シングルチャンネル,グレースケールの入力画像></param>
        /// <param name="method">現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている.</param>
        /// <param name="dp">画像分解能に対する投票分解能の比率の逆数.</param>
        /// <param name="minDist">検出される円の中心同士の最小距離.</param>
        /// <returns>検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます</returns>
#else
        /// <summary>
        /// Finds circles in a grayscale image using a Hough transform.
        /// </summary>
        /// <param name="image">The 8-bit, single-channel, grayscale input image</param>
        /// <param name="method">Currently, the only implemented method is HoughCirclesMethod.Gradient</param>
        /// <param name="dp">The inverse ratio of the accumulator resolution to the image resolution. </param>
        /// <param name="minDist">Minimum distance between the centers of the detected circles. </param>
        /// <returns>The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)</returns>
#endif
        public static CvCircleSegment[] HoughCircles(Mat image, HoughCirclesMethod method, double dp, double minDist)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            using (StdVectorVec3f vec = new StdVectorVec3f())
            {
                CppInvoke.cv_HoughCircles(image.CvPtr, vec.CvPtr, method, dp, minDist, 100, 100, 0, 0);
                return vec.ToArray<CvCircleSegment>();
            }
        }
Exemple #13
0
        /// <summary>
        /// ハフ変換を用いてグレースケール画像中の円を検出する
        /// </summary>
        /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param>
        /// <param name="circle_storage">検出された円を保存するメモリストレージ</param>
        /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param>
        /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param>
        /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param>
        /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param>
        /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds circles in grayscale image using Hough transform.
        /// </summary>
        /// <param name="image">The input 8-bit single-channel grayscale image. </param>
        /// <param name="circle_storage">The storage for the circles detected. It can be a memory storage or single row/single column matrix (CvMat*) of type CV_32FC3, to which the circles' parameters are written. </param>
        /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param>
        /// <param name="dp">Resolution of the accumulator used to detect centers of the circles. For example, if it is 1, the accumulator will have the same resolution as the input image, if it is 2 - accumulator will have twice smaller width and height, etc. </param>
        /// <param name="min_dist">Minimum distance between centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed. </param>
        /// <param name="param1">The first method-specific parameter. In case of CV_HOUGH_GRADIENT it is the higher threshold of the two passed to Canny edge detector (the lower one will be twice smaller). </param>
        /// <param name="param2">The second method-specific parameter. In case of CV_HOUGH_GRADIENT it is accumulator threshold at the center detection stage. The smaller it is, the more false circles may be detected. Circles, corresponding to the larger accumulator values, will be returned first. </param>
        /// <returns></returns>
#endif
        public static CvSeq<CvCircleSegment> HoughCircles(CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2)
        {
            return HoughCircles(image, circle_storage, method, dp, min_dist, param1, param2, 0, 0);
        }