示例#1
0
        /// <summary>
        /// 標準ハフ変換を用いて,2値画像から直線を検出します.
        /// </summary>
        /// <param name="image">8ビット,シングルチャンネルの2値入力画像.この画像は関数により書き換えられる可能性があります</param>
        /// <param name="rho">ピクセル単位で表される投票空間の距離分解能</param>
        /// <param name="theta">ラジアン単位で表される投票空間の角度分解能</param>
        /// <param name="threshold">投票の閾値パラメータ.十分な票( &gt; threshold )を得た直線のみが出力されます</param>
        /// <param name="srn">マルチスケールハフ変換において,距離分解能 rho  の除数となる値.[既定値は0]</param>
        /// <param name="stn">マルチスケールハフ変換において,角度分解能 theta  の除数となる値. [既定値は0]</param>
        /// <returns>検出された直線.各直線は,2要素のベクトル (rho, theta) で表現されます.
        /// rho は原点(画像の左上コーナー)からの距離, theta はラジアン単位で表される直線の回転角度です</returns>
#else
        /// <summary>
        /// Finds lines in a binary image using standard Hough transform.
        /// </summary>
        /// <param name="image">The 8-bit, single-channel, binary source image. The image may be modified by the function</param>
        /// <param name="rho">Distance resolution of the accumulator in pixels</param>
        /// <param name="theta">Angle resolution of the accumulator in radians</param>
        /// <param name="threshold">The accumulator threshold parameter. Only those lines are returned that get enough votes ( &gt; threshold )</param>
        /// <param name="srn">For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0]</param>
        /// <param name="stn">For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0]</param>
        /// <returns>The output vector of lines. Each line is represented by a two-element vector (rho, theta) . 
        /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians</returns>
#endif
        public static CvLineSegmentPolar[] HoughLines(this Mat image, double rho, double theta, int threshold, double srn = 0, double stn = 0)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            using (StdVectorVec2f vec = new StdVectorVec2f())
            {
                CppInvoke.cv_HoughLines(image.CvPtr, vec.CvPtr, rho, theta, threshold, srn, stn);
                return vec.ToArray<CvLineSegmentPolar>();
            }
        }
示例#2
0
        public static CvPoint2D32f[] CornerSubPix(Mat image, CvSize winSize, CvSize zeroZone, CvTermCriteria criteria)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            using (StdVectorVec2f vec = new StdVectorVec2f())
            {
                CppInvoke.cv_cornerSubPix(image.CvPtr, vec.CvPtr, winSize, zeroZone, criteria);
                return vec.ToArray<CvPoint2D32f>();
            }
        }