| | 2926 | #region HoughCircles |
| | 2927 | #region circle_storage = CvMemStorage |
| | 2928 | #if LANG_JP |
| | 2929 | /// <summary> |
| | 2930 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 2931 | /// </summary> |
| | 2932 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 2933 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 2934 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 2935 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 2936 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 2937 | /// <returns></returns> |
| | 2938 | #else |
| | 2939 | /// <summary> |
| | 2940 | /// Finds circles in grayscale image using Hough transform. |
| | 2941 | /// </summary> |
| | 2942 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 2943 | /// <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> |
| | 2944 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 2945 | /// <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> |
| | 2946 | /// <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> |
| | 2947 | /// <returns></returns> |
| | 2948 | #endif |
| | 2949 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMemStorage circle_storage, HoughCirclesMethod method, double dp, double min_dist) |
| | 2950 | { |
| | 2951 | return HoughCircles(image, circle_storage, method, dp, min_dist, 100, 100, 0, 0); |
| | 2952 | } |
| | 2953 | #if LANG_JP |
| | 2954 | /// <summary> |
| | 2955 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 2956 | /// </summary> |
| | 2957 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 2958 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 2959 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 2960 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 2961 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 2962 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 2963 | /// <returns></returns> |
| | 2964 | #else |
| | 2965 | /// <summary> |
| | 2966 | /// Finds circles in grayscale image using Hough transform. |
| | 2967 | /// </summary> |
| | 2968 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 2969 | /// <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> |
| | 2970 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 2971 | /// <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> |
| | 2972 | /// <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> |
| | 2973 | /// <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> |
| | 2974 | /// <returns></returns> |
| | 2975 | #endif |
| | 2976 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMemStorage circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1) |
| | 2977 | { |
| | 2978 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, 100, 0, 0); |
| | 2979 | } |
| | 2980 | #if LANG_JP |
| | 2981 | /// <summary> |
| | 2982 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 2983 | /// </summary> |
| | 2984 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 2985 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 2986 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 2987 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 2988 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 2989 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 2990 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 2991 | /// <returns></returns> |
| | 2992 | #else |
| | 2993 | /// <summary> |
| | 2994 | /// Finds circles in grayscale image using Hough transform. |
| | 2995 | /// </summary> |
| | 2996 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 2997 | /// <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> |
| | 2998 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 2999 | /// <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> |
| | 3000 | /// <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> |
| | 3001 | /// <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> |
| | 3002 | /// <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> |
| | 3003 | /// <returns></returns> |
| | 3004 | #endif |
| | 3005 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMemStorage circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2) |
| | 3006 | { |
| | 3007 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, param2, 0, 0); |
| | 3008 | } |
| | 3009 | #if LANG_JP |
| | 3010 | /// <summary> |
| | 3011 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3012 | /// </summary> |
| | 3013 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3014 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3015 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3016 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3017 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3018 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3019 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 3020 | /// <param name="min_radius">検出すべき円の最小半径.</param> |
| | 3021 | /// <returns></returns> |
| | 3022 | #else |
| | 3023 | /// <summary> |
| | 3024 | /// Finds circles in grayscale image using Hough transform. |
| | 3025 | /// </summary> |
| | 3026 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3027 | /// <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> |
| | 3028 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3029 | /// <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> |
| | 3030 | /// <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> |
| | 3031 | /// <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> |
| | 3032 | /// <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> |
| | 3033 | /// <param name="min_radius">Minimal radius of the circles to search for. </param> |
| | 3034 | /// <returns></returns> |
| | 3035 | #endif |
| | 3036 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMemStorage circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2, int min_radius) |
| | 3037 | { |
| | 3038 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, param2, min_radius, 0); |
| | 3039 | } |
| | 3040 | #if LANG_JP |
| | 3041 | /// <summary> |
| | 3042 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3043 | /// </summary> |
| | 3044 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3045 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3046 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3047 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3048 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3049 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3050 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 3051 | /// <param name="min_radius">検出すべき円の最小半径.</param> |
| | 3052 | /// <param name="max_radius">検出すべき円の最大半径 デフォルトの最大半径は max(image_width, image_height) にセットされている.</param> |
| | 3053 | /// <returns></returns> |
| | 3054 | #else |
| | 3055 | /// <summary> |
| | 3056 | /// Finds circles in grayscale image using Hough transform. |
| | 3057 | /// </summary> |
| | 3058 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3059 | /// <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> |
| | 3060 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3061 | /// <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> |
| | 3062 | /// <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> |
| | 3063 | /// <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> |
| | 3064 | /// <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> |
| | 3065 | /// <param name="min_radius">Minimal radius of the circles to search for. </param> |
| | 3066 | /// <param name="max_radius">Maximal radius of the circles to search for. By default the maximal radius is set to max(image_width, image_height). </param> |
| | 3067 | /// <returns></returns> |
| | 3068 | #endif |
| | 3069 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMemStorage circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2, int min_radius, int max_radius) |
| | 3070 | { |
| | 3071 | if (image == null) |
| | 3072 | throw new ArgumentNullException("image"); |
| | 3073 | if (circle_storage == null) |
| | 3074 | throw new ArgumentNullException("circle_storage"); |
| | 3075 | IntPtr result = CvDll.cvHoughCircles(image.CvPtr, circle_storage.CvPtr, method, dp, min_dist, param1, param2, min_radius, max_radius); |
| | 3076 | if (result == IntPtr.Zero) |
| | 3077 | return null; |
| | 3078 | else |
| | 3079 | return new CvSeq<CvCircleSegment>(result); |
| | 3080 | } |
| | 3081 | #endregion |
| | 3082 | #region circle_storage = CvMat |
| | 3083 | #if LANG_JP |
| | 3084 | /// <summary> |
| | 3085 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3086 | /// </summary> |
| | 3087 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3088 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3089 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3090 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3091 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3092 | /// <returns></returns> |
| | 3093 | #else |
| | 3094 | /// <summary> |
| | 3095 | /// Finds circles in grayscale image using Hough transform. |
| | 3096 | /// </summary> |
| | 3097 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3098 | /// <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> |
| | 3099 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3100 | /// <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> |
| | 3101 | /// <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> |
| | 3102 | /// <returns></returns> |
| | 3103 | #endif |
| | 3104 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist) |
| | 3105 | { |
| | 3106 | return HoughCircles(image, circle_storage, method, dp, min_dist, 100, 100, 0, 0); |
| | 3107 | } |
| | 3108 | #if LANG_JP |
| | 3109 | /// <summary> |
| | 3110 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3111 | /// </summary> |
| | 3112 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3113 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3114 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3115 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3116 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3117 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3118 | /// <returns></returns> |
| | 3119 | #else |
| | 3120 | /// <summary> |
| | 3121 | /// Finds circles in grayscale image using Hough transform. |
| | 3122 | /// </summary> |
| | 3123 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3124 | /// <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> |
| | 3125 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3126 | /// <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> |
| | 3127 | /// <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> |
| | 3128 | /// <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> |
| | 3129 | /// <returns></returns> |
| | 3130 | #endif |
| | 3131 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1) |
| | 3132 | { |
| | 3133 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, 100, 0, 0); |
| | 3134 | } |
| | 3135 | #if LANG_JP |
| | 3136 | /// <summary> |
| | 3137 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3138 | /// </summary> |
| | 3139 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3140 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3141 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3142 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3143 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3144 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3145 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 3146 | /// <returns></returns> |
| | 3147 | #else |
| | 3148 | /// <summary> |
| | 3149 | /// Finds circles in grayscale image using Hough transform. |
| | 3150 | /// </summary> |
| | 3151 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3152 | /// <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> |
| | 3153 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3154 | /// <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> |
| | 3155 | /// <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> |
| | 3156 | /// <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> |
| | 3157 | /// <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> |
| | 3158 | /// <returns></returns> |
| | 3159 | #endif |
| | 3160 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2) |
| | 3161 | { |
| | 3162 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, param2, 0, 0); |
| | 3163 | } |
| | 3164 | #if LANG_JP |
| | 3165 | /// <summary> |
| | 3166 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3167 | /// </summary> |
| | 3168 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3169 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3170 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3171 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3172 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3173 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3174 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 3175 | /// <param name="min_radius">検出すべき円の最小半径.</param> |
| | 3176 | /// <returns></returns> |
| | 3177 | #else |
| | 3178 | /// <summary> |
| | 3179 | /// Finds circles in grayscale image using Hough transform. |
| | 3180 | /// </summary> |
| | 3181 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3182 | /// <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> |
| | 3183 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3184 | /// <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> |
| | 3185 | /// <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> |
| | 3186 | /// <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> |
| | 3187 | /// <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> |
| | 3188 | /// <param name="min_radius">Minimal radius of the circles to search for. </param> |
| | 3189 | /// <returns></returns> |
| | 3190 | #endif |
| | 3191 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2, int min_radius) |
| | 3192 | { |
| | 3193 | return HoughCircles(image, circle_storage, method, dp, min_dist, param1, param2, min_radius, 0); |
| | 3194 | } |
| | 3195 | #if LANG_JP |
| | 3196 | /// <summary> |
| | 3197 | /// ハフ変換を用いてグレースケール画像中の円を検出する |
| | 3198 | /// </summary> |
| | 3199 | /// <param name="image">入力画像 (8ビット,シングルチャンネル,グレースケール).</param> |
| | 3200 | /// <param name="circle_storage">検出された円を保存するメモリストレージ</param> |
| | 3201 | /// <param name="method">現状では,CV_HOUGH_GRADIENT(基本的な2段階のハフ変換)のみ実装されている. </param> |
| | 3202 | /// <param name="dp">円の中心を求める際に用いられる計算時の解像度.例えば,この値が 1 の場合は,計算は入力画像と同じ解像度で行われる.2 の場合は,計算は幅・高さともに1/2の解像度になる,等. </param> |
| | 3203 | /// <param name="min_dist">円検出における中心座標間の最小間隔.この値が非常に小さい場合は,正しく抽出されるべき円の近傍に複数の間違った円が検出されることになる.また,逆に非常に大きい場合は,円検出に失敗する. </param> |
| | 3204 | /// <param name="param1">手法に応じた1番目のパラメータ. CV_HOUGH_GRADIENT の場合は,Cannyのエッジ検出器で用いる二つの閾値の高い方の値 (低い方の値は,この値を1/2したものになる).</param> |
| | 3205 | /// <param name="param2">手法に応じた2番目のパラメータ. CV_HOUGH_GRADIENT の場合は,中心検出計算時の閾値.小さすぎると誤検出が多くなる.これに対応する値が大きい円から順に検出される.</param> |
| | 3206 | /// <param name="min_radius">検出すべき円の最小半径.</param> |
| | 3207 | /// <param name="max_radius">検出すべき円の最大半径 デフォルトの最大半径は max(image_width, image_height) にセットされている.</param> |
| | 3208 | /// <returns></returns> |
| | 3209 | #else |
| | 3210 | /// <summary> |
| | 3211 | /// Finds circles in grayscale image using Hough transform. |
| | 3212 | /// </summary> |
| | 3213 | /// <param name="image">The input 8-bit single-channel grayscale image. </param> |
| | 3214 | /// <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> |
| | 3215 | /// <param name="method">Currently, the only implemented method is CV_HOUGH_GRADIENT, which is basically 21HT</param> |
| | 3216 | /// <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> |
| | 3217 | /// <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> |
| | 3218 | /// <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> |
| | 3219 | /// <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> |
| | 3220 | /// <param name="min_radius">Minimal radius of the circles to search for. </param> |
| | 3221 | /// <param name="max_radius">Maximal radius of the circles to search for. By default the maximal radius is set to max(image_width, image_height). </param> |
| | 3222 | /// <returns></returns> |
| | 3223 | #endif |
| | 3224 | public static CvSeq<CvCircleSegment> HoughCircles(this CvArr image, CvMat circle_storage, HoughCirclesMethod method, double dp, double min_dist, double param1, double param2, int min_radius, int max_radius) |
| | 3225 | { |
| | 3226 | if (image == null) |
| | 3227 | throw new ArgumentNullException("image"); |
| | 3228 | if (circle_storage == null) |
| | 3229 | throw new ArgumentNullException("circle_storage"); |
| | 3230 | IntPtr result = CvDll.cvHoughCircles(image.CvPtr, circle_storage.CvPtr, method, dp, min_dist, param1, param2, min_radius, max_radius); |
| | 3231 | if (result == IntPtr.Zero) |
| | 3232 | return null; |
| | 3233 | else |
| | 3234 | return new CvSeq<CvCircleSegment>(result); |
| | 3235 | } |
| | 3236 | #endregion |
| | 3237 | #endregion |