當前位置: 首頁>>代碼示例>>C#>>正文


C# IplImage.ConvertScale方法代碼示例

本文整理匯總了C#中OpenCvSharp.IplImage.ConvertScale方法的典型用法代碼示例。如果您正苦於以下問題:C# IplImage.ConvertScale方法的具體用法?C# IplImage.ConvertScale怎麽用?C# IplImage.ConvertScale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenCvSharp.IplImage的用法示例。


在下文中一共展示了IplImage.ConvertScale方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FeatureDetector

        private IplImage FeatureDetector(Bitmap bitmapIn)
        {
            double minVal, maxVal;
            IplImage i1 = BitmapConverter.ToIplImage(bitmapIn);

            IplImage gray = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);
            IplImage blur = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);
            IplImage gaussian = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);
            IplImage laplace = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.F32, gaussian.NChannels);
            IplImage converted = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);
            IplImage normalized = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);
            IplImage tresh = new IplImage(new OpenCvSharp.CvSize(i1.Size.Width, i1.Size.Height), BitDepth.U8, 1);

            OpenCvSharp.Cv.CvtColor(i1, gray, ColorConversion.RgbToGray);
            OpenCvSharp.Cv.Normalize(gray, normalized, 0.0, 255.0, NormType.MinMax);
            OpenCvSharp.Cv.Smooth(normalized, blur, SmoothType.Median, 5, 5);
            OpenCvSharp.Cv.Smooth(blur, gaussian, SmoothType.Gaussian, 5, 5);
            OpenCvSharp.Cv.Laplace(gaussian, laplace, ApertureSize.Size5);

            laplace.MinMaxLoc(out minVal, out maxVal);
            laplace.ConvertScale(converted, 255.0 / (2.0 * maxVal), 128);

            OpenCvSharp.Cv.Threshold(converted, tresh, 150.0, 255.0, ThresholdType.Binary);

            return tresh;
        }
開發者ID:fishbot,項目名稱:fishbot,代碼行數:26,代碼來源:Form1.cs


注:本文中的OpenCvSharp.IplImage.ConvertScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。