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


C# IplImage.Smooth方法代碼示例

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


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

示例1: ConvertToWriteableBitmap

        public ConvertToWriteableBitmap()
        {
            WriteableBitmap wb = null;

            // OpenCVによる畫像処理 (Threshold)
            using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> WriteableBitmap
                wb = dst.ToWriteableBitmap(PixelFormats.BlackWhite);
                //wb = WriteableBitmapConverter.ToWriteableBitmap(dst, PixelFormats.BlackWhite);
            }

            // WPFのWindowに表示してみる
            Image image = new Image { Source = wb };
            Window window = new Window
            {
                Title = "from IplImage to WriteableBitmap",
                Width = wb.PixelWidth,
                Height = wb.PixelHeight,
                Content = image
            };

            Application app = new Application();
            app.Run(window);
        }
開發者ID:qxp1011,項目名稱:opencvsharp,代碼行數:28,代碼來源:ConvertToWriteableBitmap.cs

示例2: ConvertToBitmapSource

        public ConvertToBitmapSource()
        {
            BitmapSource bs = null;

            // OpenCVによる畫像処理 (Threshold)
            using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> BitmapSource
                bs = dst.ToBitmapSource();
                //bs = BitmapSourceConverter.ToBitmapSource(dst);
            }

            // WPFのWindowに表示してみる
            Image image = new Image { Source = bs };
            Window window = new Window
            {
                Title = "from IplImage to BitmapSource",
                Width = bs.PixelWidth,
                Height = bs.PixelHeight,
                Content = image
            };

            Application app = new Application();
            app.Run(window);
        }
開發者ID:neoxeo,項目名稱:opencvsharp,代碼行數:28,代碼來源:ConvertToBitmapSource.cs

示例3: ConvertToWriteableBitmap

        public ConvertToWriteableBitmap()
        {
            WriteableBitmap wb = null;

            // OpenCV processing
            using (var src = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
            using (var dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> WriteableBitmap
                wb = dst.ToWriteableBitmap(PixelFormats.BlackWhite);
                //wb = WriteableBitmapConverter.ToWriteableBitmap(dst, PixelFormats.BlackWhite);
            }

            // Shows WriteableBitmap to WPF window
            var image = new Image { Source = wb };
            var window = new Window
            {
                Title = "from IplImage to WriteableBitmap",
                Width = wb.PixelWidth,
                Height = wb.PixelHeight,
                Content = image
            };

            var app = new Application();
            app.Run(window);
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:28,代碼來源:ConvertToWriteableBitmap.cs

示例4: ConvertToBitmap

        public ConvertToBitmap()
        {
            Bitmap bitmap = null;

            // do cvThreshold
            using (IplImage src = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> Bitmap
                bitmap = dst.ToBitmap();
                //bitmap = BitmapConverter.ToBitmap(dst);
            }

            // visualize using WindowsForm
            Form form = new Form
            {
                Text = "from IplImage to Bitmap",
                ClientSize = bitmap.Size,
            };
            PictureBox pictureBox = new PictureBox
            {
                Dock = DockStyle.Fill,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image = bitmap
            };

            form.Controls.Add(pictureBox);
            form.ShowDialog();

            form.Dispose();
            bitmap.Dispose();
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:34,代碼來源:ConvertToBitmap.cs

示例5: Threshold

 public Threshold()
 {
     using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.Color))
     using (IplImage srcGray = new IplImage(src.Size, BitDepth.U8, 1))
     using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
     using (CvWindow window = new CvWindow("SampleThreshold"))
     {
         src.CvtColor(srcGray, ColorConversion.BgrToGray);
         srcGray.Smooth(srcGray, SmoothType.Gaussian, 5);
         int threshold = 90;
         window.CreateTrackbar("threshold", threshold, 255, delegate(int pos)
         {
             srcGray.Threshold(dst, pos, 255, ThresholdType.Binary);
             window.Image = dst;
         });
         srcGray.Threshold(dst, threshold, 255, ThresholdType.Binary);
         window.Image = dst;
         CvWindow.WaitKey();
     }
 }
開發者ID:neoxeo,項目名稱:opencvsharp,代碼行數:20,代碼來源:Threshold.cs

示例6: ConvertToBitmap

        public ConvertToBitmap()
        {
            Bitmap bitmap = null;

            // OpenCVによる畫像処理 (Threshold)
            using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> Bitmap
                bitmap = dst.ToBitmap();
                //bitmap = BitmapConverter.ToBitmap(dst);
            }

            // WindowsFormに表示してみる
            Form form = new Form
            {
                Text = "from IplImage to Bitmap",
                ClientSize = bitmap.Size,
            };
            PictureBox pictureBox = new PictureBox
            {
                Dock = DockStyle.Fill,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image = bitmap
            };
            /*
            Imageプロパティに設定するのはもしかするとちょっと微妙、できればこのように
            pictureBox.Paint += delegate(object sender, PaintEventArgs e) {
                e.Graphics.DrawImage(bitmap, new Rectangle(new Point(0, 0), form.ClientSize));
            };
            */
            form.Controls.Add(pictureBox);
            form.ShowDialog();

            form.Dispose();
            bitmap.Dispose();
        }
開發者ID:neoxeo,項目名稱:opencvsharp,代碼行數:39,代碼來源:ConvertToBitmap.cs


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