• 大小: 76.81MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-12-05
  • 语言: 其他
  • 标签: EmguCV  

资源简介

1.EmguCV的使用 2.图片灰度化 3.图片均衡化 4.图片二值化 5.canny算子边缘检测 6.利用EmguCV画图 7.图片数字识别

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CvTest
{
    using System.Diagnostics;
    using System.Drawing.Imaging;
    using System.Runtime.InteropServices;

    using Emgu.CV;
    using Emgu.CV.CvEnum;
    using Emgu.CV.OCR;
    using Emgu.CV.Structure;

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            var image = new Image(“1-1.png“);
            this.pictureBox1.Image = image.ToBitmap();
            var grayimage = image.Convert();
            this.pictureBox2.Image = grayimage.ToBitmap();
            //var threshImage = grayimage.ThresholdAdaptive(new Gray(255) AdaptiveThresholdType.MeanC ThresholdType.Binary 9 new Gray(5));
            //CvInvoke.NamedWindow(“ThresholdAdaptive“);
            //CvInvoke.Imshow(“ThresholdAdaptive“ threshImage);
            //CvInvoke.Threshold(grayimage threshimg 0 255 ThresholdType.Otsu);

            //CvInvoke.NamedWindow(“Otsu“);
            //CvInvoke.Imshow(“Otsu“ threshImage);
            //CvInvoke.Line(image new Point(10 10) new Point(150 150) new MCvScalar(2112030));
            //CvInvoke.NamedWindow(“line“);
            //CvInvoke.Imshow(“line“ image);

            //均衡化
            Image histimg = new Image(grayimage.Width grayimage.Height new Gray(0.1));
            CvInvoke.EqualizeHist(grayimage histimg);
            MIplImage histmi = (MIplImage)Marshal.PtrToStructure(histimg typeof(MIplImage));
            Image histimage = new Image(histimg.Width histimg.Height histmi.WidthStep histmi.ImageData);
            this.pictureBox5.Image = histimage.ToBitmap();

            //二值化
            Image threshimg = new Image(grayimage.Width grayimage.Height);
            CvInvoke.Threshold(histimg threshimg 120 255 ThresholdType.Binary);
            this.pictureBox3.Image = threshimg.ToBitmap();

            //canny算子边缘检测
            Image cannyimg = new Image(grayimage.Width grayimage.Height new Gray(0.1));
            CvInvoke.Canny(threshimg cannyimg 10 30);
            MIplImage cannymi = (MIplImage)Marshal.PtrToStructure(cannyimg typeof(MIplImage));
            Image cannyimage = new Image(cannymi.Width cannymi.Height cannymi.WidthStep cannymi.ImageData);
            this.pictureBox4.Image = cannyimage.ToBitmap();


            //circle画圈
            Image circleimg = new Image(grayimage.Width grayimage.Height new Gray(255));
            CvInvoke.Circle(circleimg new Point(150 150) 50 new M

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-19 10:36  CvTest\
     文件       62797  2018-09-19 10:12  CvTest\1-1.png
     文件        1604  2018-09-19 10:13  CvTest\9502.jpg
     文件         540  2017-09-29 13:54  CvTest\App.config
     目录           0  2018-09-19 10:17  CvTest\Connected Services\
     文件        6904  2018-09-19 10:34  CvTest\CvTest.csproj
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\build\
     文件        2844  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\Emgu.CV.targets
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\build\x64\
     文件      333632  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x64\concrt140.dll
     文件    31221248  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x64\cvextern.dll
     文件      633152  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x64\msvcp140.dll
     文件    17397760  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x64\opencv_ffmpeg320_64.dll
     文件       87888  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x64\vcruntime140.dll
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\build\x86\
     文件      244032  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x86\concrt140.dll
     文件    25121280  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x86\cvextern.dll
     文件      440120  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x86\msvcp140.dll
     文件    16480768  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x86\opencv_ffmpeg320.dll
     文件       83784  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\build\x86\vcruntime140.dll
     文件    40470291  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\Emgu.CV.3.2.0.2721.nupkg
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\lib\
     目录           0  2018-09-19 10:16  CvTest\Emgu.CV.3.2.0.2721\lib\net35\
     文件      118272  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\lib\net35\Emgu.CV.UI.dll
     文件       34738  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\lib\net35\Emgu.CV.UI.xml
     文件      612352  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\lib\net35\Emgu.CV.World.dll
     文件     1683817  2017-08-07 10:34  CvTest\Emgu.CV.3.2.0.2721\lib\net35\Emgu.CV.World.xml
     文件        6439  2018-09-19 10:34  CvTest\Form1.cs
     文件        8443  2017-08-23 15:18  CvTest\Form1.Designer.cs
     文件        5817  2017-08-23 15:18  CvTest\Form1.resx
............此处省略9个文件信息

评论

共有 条评论