コード例 #1
0
        public static Bitmap Canny(Bitmap src, int left, int right, int size)
        {
            ApertureSize apperture = ApertureSize.Size3;

            switch (size)
            {
            case 0:
                apperture = ApertureSize.Size3; break;

            case 1:
                apperture = ApertureSize.Size3; break;

            case 2:
                apperture = ApertureSize.Size5; break;

            case 3:
                apperture = ApertureSize.Size7; break;
            }
            using (IplImage temp = src.ToIplImage())
            {
                using (IplImage gray = Cv.CreateImage(Cv.GetSize(temp), BitDepth.U8, 1))
                {
                    using (IplImage dst = Cv.CreateImage(Cv.GetSize(temp), BitDepth.U8, 1))
                    {
                        Cv.CvtColor(temp, gray, ColorConversion.RgbToGray);
                        Cv.Canny(gray, dst, left, right, apperture);
                        return(dst.ToBitmap());
                    }
                }
            }
        }
コード例 #2
0
ファイル: CvCpp.cs プロジェクト: qxp1011/opencvsharp
        /// <summary>
        /// Cannyアルゴリズムを用いて,画像のエッジを検出します.
        /// </summary>
        /// <param name="image">8ビット,シングルチャンネルの入力画像</param>
        /// <param name="edges">出力されるエッジのマップ. image  と同じサイズ,同じ型</param>
        /// <param name="threshold1">ヒステリシスが存在する処理の,1番目の閾値</param>
        /// <param name="threshold2">ヒステリシスが存在する処理の,2番目の閾値</param>
        /// <param name="apertureSize">Sobelオペレータのアパーチャサイズ [既定値はApertureSize.Size3]</param>
        /// <param name="L2gradient">画像勾配の強度を求めるために,より精度の高い L2ノルムを利用するか,L1ノルムで十分(false)かを指定します. [既定値はfalse]</param>
#else
        /// <summary>
        /// Finds edges in an image using Canny algorithm.
        /// </summary>
        /// <param name="image">Single-channel 8-bit input image</param>
        /// <param name="edges">The output edge map. It will have the same size and the same type as image</param>
        /// <param name="threshold1">The first threshold for the hysteresis procedure</param>
        /// <param name="threshold2">The second threshold for the hysteresis procedure</param>
        /// <param name="apertureSize">Aperture size for the Sobel operator [By default this is ApertureSize.Size3]</param>
        /// <param name="L2gradient">Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false]</param>
#endif
        public static void Canny(Mat image, Mat edges, double threshold1, double threshold2, ApertureSize apertureSize = ApertureSize.Size3, bool L2gradient = false)
        {
            if (image == null)
                throw new ArgumentNullException("image");
            if (edges == null)
                throw new ArgumentNullException("edges");
            CppInvoke.cv_Canny(image.CvPtr, edges.CvPtr, threshold1, threshold2, apertureSize, L2gradient);
        }
コード例 #3
0
ファイル: CvInvoke.cs プロジェクト: sanglin307/UnityOpenCV
 public static extern void cvCornerMinEigenVal(IntPtr image, IntPtr eigenval, int block_size, ApertureSize aperture_size);
コード例 #4
0
ファイル: CvInvoke.cs プロジェクト: sanglin307/UnityOpenCV
 public static extern void cvCornerHarris(IntPtr image, IntPtr harris_responce, int block_size, ApertureSize aperture_size, double k);
コード例 #5
0
ファイル: CvInvoke.cs プロジェクト: sanglin307/UnityOpenCV
 public static extern void cvCornerEigenValsAndVecs(IntPtr image, IntPtr eigenvv, int block_size, ApertureSize aperture_size);