├── README.md ├── EmgucvDemo ├── App.config ├── packages.config ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── Form │ ├── FormEqualizeHist.cs │ ├── FormCapture .cs │ ├── FormCameraCali.cs │ ├── FormRemap.cs │ ├── FormExtract.cs │ ├── FormImageSegment.cs │ ├── FormColor.cs │ ├── FormPyramid.cs │ ├── FormFloodFill.cs │ ├── FormWarpPerspective.cs │ ├── FormBinary.cs │ ├── FormWarpAffine.cs │ ├── FormAbsDiff.cs │ ├── FormROI.cs │ ├── FormStitching.cs │ ├── FormOCR.cs │ ├── FormTemplateMatch.cs │ ├── FormMorphology.cs │ ├── FormBackProjection.cs │ ├── FormHull.cs │ ├── FormBlob.cs │ ├── FormCorner.cs │ ├── FormContour.cs │ ├── FormCapture .Designer.cs │ ├── FormCorner.Designer.cs │ ├── FormHull.Designer.cs │ ├── FormRemap.Designer.cs │ ├── FormFloodFill.Designer.cs │ ├── FormImageSegment.Designer.cs │ ├── FormBlob.designer.cs │ ├── FormTemplateMatch.Designer.cs │ ├── FormHough.cs │ ├── FormCircle.cs │ ├── FormFilter.cs │ ├── FormDFT.Designer.cs │ ├── FormEdge.cs │ ├── FormMorphology.Designer.cs │ ├── FormBackProjection.Designer.cs │ ├── FormOCR.Designer.cs │ ├── FormCameraCali.Designer.cs │ ├── FormAbsDiff.resx │ ├── FormBinary.resx │ ├── FormBlob.resx │ ├── FormCircle.resx │ ├── FormColor.resx │ └── FormContour.resx ├── 特征点 │ └── FormFeature.cs ├── FormLicensePlate.Designer.cs ├── LicensePlateRecognition │ ├── FormLicensePlate.cs │ └── FormLicensePlate.Designer.cs └── FormLicensePlate.cs └── EmgucvDemo.sln /README.md: -------------------------------------------------------------------------------- 1 | # EmguCVTool 2 | 图像处理工具,包含基本的图像处理 3 | -------------------------------------------------------------------------------- /EmgucvDemo/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EmgucvDemo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /EmgucvDemo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EmgucvDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace EmgucvDemo 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new FormMain()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EmgucvDemo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmgucvDemo", "EmgucvDemo\EmgucvDemo.csproj", "{1F4EC5CC-2DF3-487F-A0A9-DD6DC56A7097}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {1F4EC5CC-2DF3-487F-A0A9-DD6DC56A7097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {1F4EC5CC-2DF3-487F-A0A9-DD6DC56A7097}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {1F4EC5CC-2DF3-487F-A0A9-DD6DC56A7097}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {1F4EC5CC-2DF3-487F-A0A9-DD6DC56A7097}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /EmgucvDemo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace EmgucvDemo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EmgucvDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("EmgucvDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EmgucvDemo")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | //将 ComVisible 设置为 false 将使此程序集中的类型 18 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("1f4ec5cc-2df3-487f-a0a9-dd6dc56a7097")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormEqualizeHist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Emgu.CV; 4 | using Emgu.CV.Structure; 5 | using Emgu.CV.CvEnum; 6 | 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormEqualizeHist : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | 16 | 17 | public FormEqualizeHist() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | open = new OpenFileDialog(); 25 | if (open.ShowDialog() == DialogResult.OK) 26 | { 27 | filename = open.FileName; 28 | imageBox1.Load(filename); 29 | } 30 | src = new Image(open.FileName); 31 | } 32 | 33 | private void Form2_Load(object sender, EventArgs e) 34 | { 35 | 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | Mat Histimg = new Mat(CvInvoke.cvGetSize(src), DepthType.Cv8U, 1); 41 | CvInvoke.EqualizeHist(src,//单通道8bit图像 42 | Histimg); //均衡化 43 | imageBox2.Image = Histimg; 44 | 45 | } 46 | 47 | private void button3_Click(object sender, EventArgs e) 48 | { 49 | CvInvoke.Imwrite(@"1.bmp", imageBox2.Image); 50 | 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCapture .cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Emgu.CV; 4 | 5 | 6 | namespace EmgucvDemo 7 | { 8 | public partial class FormCapture : Form 9 | { 10 | VideoCapture _capture; 11 | Mat frame = new Mat(); 12 | 13 | public FormCapture() 14 | { 15 | InitializeComponent(); 16 | _capture = new VideoCapture(); 17 | _capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 320);//设置捕捉到帧的高度为320 18 | _capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 240);//设置捕捉到帧的宽度为240 19 | _capture.FlipHorizontal = true;//捕捉到帧数据进行水平翻转 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | Write(frame); 25 | _capture.ImageGrabbed += new EventHandler(video);//捕捉到帧执行线程 26 | _capture.Start();//开始捕捉帧 27 | 28 | //或者以下代码实现 29 | // Application.Idle +=new EventHandler(frame); 30 | } 31 | 32 | private void video(object sender,EventArgs e) 33 | { 34 | _capture.Retrieve(frame,0);//进行帧捕捉 35 | imageBox1.Image = frame; 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | _capture.Stop();//暂停捕捉帧 41 | 42 | } 43 | 44 | public void Write(Mat frame) 45 | { 46 | string path = "C:\\Users\\Public\\Desktop\\1.avi"; 47 | VideoWriter _Wvideo = new VideoWriter(path, VideoWriter.Fourcc('M', 'J', 'P', 'G'), 25, frame.Size, true); 48 | _Wvideo.Write(frame); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCameraCali.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | using Emgu.CV.CvEnum; 13 | using Emgu.CV.UI; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormCameraCali : Form 18 | { 19 | 20 | public FormCameraCali() 21 | { 22 | InitializeComponent(); 23 | } 24 | Mat[] imgs = new Mat[3]; 25 | private void button1_Click(object sender, EventArgs e) 26 | { 27 | Image[] images=new Image[3]; 28 | imgs[0] = CvInvoke.Imread(@"E:\工作\项目\3.云台自动化线\胶水检测\点胶照片\1.bmp"); 29 | imgs[1] = CvInvoke.Imread(@"E:\工作\项目\3.云台自动化线\胶水检测\点胶照片\2.bmp"); 30 | imgs[2] = CvInvoke.Imread(@"E:\工作\项目\3.云台自动化线\胶水检测\点胶照片\3.bmp"); 31 | imageList1.ColorDepth = ColorDepth.Depth24Bit; 32 | imageList1.Images.Add(imgs[0].Bitmap) ; 33 | imageList1.Images.Add(imgs[1].Bitmap); 34 | imageList1.Images.Add(imgs[2].Bitmap); 35 | 36 | pictureBox1.Image = imageList1.Images[0]; 37 | pictureBox2.Image = imageList1.Images[1]; 38 | pictureBox3.Image = imageList1.Images[2]; 39 | 40 | } 41 | 42 | private void button2_Click(object sender, EventArgs e) 43 | { 44 | pictureBox1.Image = imageList1.Images[1]; 45 | pictureBox2.Image = imageList1.Images[2]; 46 | pictureBox3.Image = imageList1.Images[0]; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormRemap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Stitching; 12 | using Emgu.CV.Structure; 13 | using Emgu.CV.Util; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormRemap : Form 18 | { 19 | static string filename; 20 | OpenFileDialog open; 21 | Image srcImage; 22 | public FormRemap() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void button1_Click(object sender, EventArgs e) 28 | { 29 | open = new OpenFileDialog(); 30 | if (open.ShowDialog() == DialogResult.OK) 31 | { 32 | filename = open.FileName; 33 | imageBox1.Load(filename); 34 | srcImage = new Image(open.FileName); 35 | } 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | Image dstImage = srcImage.CopyBlank(); 41 | Image map_x = srcImage.CopyBlank().Convert(); 42 | Image map_y = srcImage.CopyBlank().Convert(); 43 | 44 | // Mat map_x = new Mat(srcImage.Size, Emgu.CV.CvEnum.DepthType.Cv32F, 1); 45 | // Mat map_y = new Mat(srcImage.Size, Emgu.CV.CvEnum.DepthType.Cv32F, 1); 46 | for(int j=0;j bgr_img; 13 | public FormExtract() 14 | { 15 | InitializeComponent(); 16 | } 17 | private void button1_Click(object sender, EventArgs e) 18 | { 19 | open = new OpenFileDialog(); 20 | if (open.ShowDialog() == DialogResult.OK) 21 | { 22 | filename = open.FileName; 23 | pictureBox2.Load(filename); 24 | bgr_img = new Image(open.FileName); 25 | } 26 | } 27 | 28 | 29 | private void button2_Click(object sender, EventArgs e) 30 | { 31 | double blue_min = double.Parse(txt_BlueMin.Text); 32 | double blue_max = double.Parse(txt_BlueMax.Text); 33 | double green_min = double.Parse(txt_GreenMin.Text); 34 | double green_max = double.Parse(txt_GreenMax.Text); 35 | double red_min = double.Parse(txt_RedMin.Text); 36 | double red_max = double.Parse(txt_RedMax.Text); 37 | Bgr min = new Bgr(blue_min, green_min, red_min);//黄色的最小值,允许一定的误差。 38 | Bgr max = new Bgr(blue_max, green_max, red_max);//黄色的最大值,允许一定的误差。 39 | Image result = bgr_img.InRange(min, max);//进行颜色提取。 40 | pictureBox2.Image = bgr_img.Bitmap;//显示输入图像。 41 | imageBox2.Image = result;//显示提取颜色区域。 42 | } 43 | 44 | private void pictureBox2_MouseDown(object sender, MouseEventArgs e) 45 | { 46 | Image img = new Image(bgr_img.Bitmap).Resize(pictureBox2.Width, pictureBox2.Height, Emgu.CV.CvEnum.Inter.Area); 47 | //获取imagebox1 控件的图片,并重置大小与控件的大小一致。 48 | Bgr color = img[e.Y, e.X]; 49 | //获得鼠标点击位置的坐标。 50 | label1.Text = color.ToString(); 51 | //显示颜色的数值。 52 | Image img1 = new Image(imageBox2.Width, imageBox2.Height, color); 53 | //以固定颜色创建一张图片,并显示在ImageBox2。用于再次确定颜色是否正确。 54 | pictureBox1.Image = img1.Bitmap; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormImageSegment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | using Emgu.Util; 13 | using Emgu.CV.CvEnum; 14 | using Emgu.CV.Util; 15 | using Emgu.CV.Features2D; 16 | using Emgu.CV.XFeatures2D; 17 | 18 | 19 | namespace EmgucvDemo 20 | { 21 | public partial class FormImageSegment : Form 22 | { 23 | static string filename; 24 | OpenFileDialog open; 25 | Image srcImage; 26 | 27 | //成员变量 28 | private string sourceImageFileName = "wky_tms_2272x1704.jpg"; //源图像文件名 29 | private Image imageSource = null; //源图像 30 | private Image imageSourceClone = null; //源图像的克隆 31 | private Image imageMarkers = null; //标记图像 32 | private double xScale = 1d; //原始图像与PictureBox 在x 轴方向上的缩放 33 | private double yScale = 1d; //原始图像与PictureBox 在y 轴方向上的缩放 34 | private Point previousMouseLocation = new Point(-1, -1); //上次绘制线条时,鼠标所处的位置 private const int LineWidth = 5; //绘制线条的宽度 35 | private int drawCount = 1; //用户绘制的线条数目,用于指定线条的颜色 36 | 37 | public FormImageSegment() 38 | { 39 | InitializeComponent(); 40 | } 41 | 42 | private void button1_Click(object sender, EventArgs e) 43 | { 44 | open = new OpenFileDialog(); 45 | if (open.ShowDialog() == DialogResult.OK) 46 | { 47 | filename = open.FileName; 48 | imageBox1.Load(filename); 49 | srcImage = new Image(open.FileName); 50 | } 51 | } 52 | 53 | private void button2_Click(object sender, EventArgs e) 54 | { 55 | Image imageMarker = new Image(srcImage.Size); 56 | CvInvoke.Watershed(srcImage, imageMarker); 57 | imageBox2.Image = imageMarker; 58 | 59 | 60 | } 61 | 62 | private void FormImageSegment_Load(object sender, EventArgs e) 63 | { 64 | 65 | 66 | } 67 | 68 | private void button3_Click(object sender, EventArgs e) 69 | { 70 | 71 | 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormColor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | using Emgu.CV.Util; 13 | 14 | namespace EmgucvDemo 15 | { 16 | public partial class FormColor : Form 17 | { 18 | Image src; 19 | 20 | static string filename; 21 | OpenFileDialog open; 22 | public FormColor() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void button2_Click(object sender, EventArgs e) 28 | { 29 | open = new OpenFileDialog(); 30 | if (open.ShowDialog() == DialogResult.OK) 31 | { 32 | filename = open.FileName; 33 | imageBox1.Load(filename); 34 | src = new Image(open.FileName); 35 | } 36 | } 37 | 38 | private void button1_Click(object sender, EventArgs e) 39 | { 40 | Image hsvImage= src.Convert (); 41 | imageBox1.Image = hsvImage; 42 | 43 | VectorOfMat channels = new VectorOfMat(); //创建vectorOfmat类型存储分离后的图像 44 | CvInvoke.Split(hsvImage, channels); //通道分离 45 | InputOutputArray mix_channel = channels.GetInputOutputArray(); //获得数组 46 | 47 | Mat H_channel = mix_channel.GetMat(0); //获得第一通道 48 | Mat S_channel = mix_channel.GetMat(1); //获得第二通道 49 | Mat V_channel = mix_channel.GetMat(2);//获得第一通道 50 | 51 | imageBox2.Image = H_channel; //显示第一通道 52 | imageBox3.Image = S_channel; //显示第二通道 53 | imageBox4.Image = V_channel; //显示第三通道 54 | 55 | } 56 | 57 | private void button3_Click(object sender, EventArgs e) 58 | { 59 | 60 | VectorOfMat channels = new VectorOfMat(); //创建vectorOfmat类型存储分离后的图像 61 | CvInvoke.Split(src, channels); //通道分离 62 | InputOutputArray mix_channel = channels.GetInputOutputArray(); //获得数组 63 | 64 | Mat B_channel = mix_channel.GetMat(0); //获得第一通道 65 | Mat G_channel = mix_channel.GetMat(1); //获得第二通道 66 | Mat R_channel = mix_channel.GetMat(2);//获得第一通道 67 | 68 | imageBox2.Image = B_channel; //显示第一通道 69 | imageBox3.Image = G_channel; //显示第二通道 70 | imageBox4.Image = R_channel; //显示第三通道 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormPyramid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Emgu.CV; 5 | using Emgu.CV.Structure; 6 | using Emgu.CV.CvEnum; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormPyramid : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | BorderType[] border_type = new BorderType[9] { BorderType.NegativeOne,BorderType.Constant, BorderType.Replicate, BorderType.Reflect, BorderType.Wrap, BorderType.Default, BorderType.Reflect101, BorderType.Transparent, BorderType.Isolated }; 16 | 17 | public FormPyramid() 18 | { 19 | InitializeComponent(); 20 | comboBox1.SelectedIndex = 1; 21 | } 22 | 23 | private void button1_Click(object sender, EventArgs e) 24 | { 25 | open = new OpenFileDialog(); 26 | if (open.ShowDialog() == DialogResult.OK) 27 | { 28 | filename = open.FileName; 29 | imageBox1.Load(filename); 30 | src = new Image(open.FileName); 31 | } 32 | } 33 | 34 | private void button2_Click(object sender, EventArgs e) 35 | { 36 | Mat dst1 = new Mat(); 37 | Mat dst2 = new Mat(); 38 | 39 | int i = comboBox1.SelectedIndex; 40 | try 41 | { 42 | CvInvoke.PyrDown(src, dst1, border_type[comboBox1.SelectedIndex]);//进行高斯向下采样(缩小) 43 | CvInvoke.PyrUp(src, dst2, border_type[comboBox1.SelectedIndex]);//进行拉普拉斯向上采样(放大) 44 | label1.Text = "原图size:" + src.Size.ToString();//获取原图大小 45 | label2.Text = "高斯向下采样输出图像size:" + dst1.Size.ToString();//获取输出图像大小 46 | label3.Text = "拉普拉斯向上采样输出图像size:" + dst2.Size.ToString(); 47 | 48 | imageBox2.Image = dst1; 49 | imageBox3.Image = dst2; 50 | } 51 | catch 52 | { 53 | throw; 54 | } 55 | 56 | } 57 | 58 | private void button4_Click(object sender, EventArgs e) 59 | { 60 | Mat dst = new Mat(); 61 | Size size = new Size(); 62 | size.Height = int.Parse(textBox1.Text); 63 | size.Width = int.Parse(textBox2.Text); 64 | CvInvoke.Resize(src, dst, size); 65 | imageBox4.Image = dst; 66 | 67 | } 68 | 69 | private void button3_Click(object sender, EventArgs e) 70 | { 71 | 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormFloodFill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.CvEnum; 12 | using Emgu.CV.Structure; 13 | using Emgu.CV.Util; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormFloodFill : Form 18 | { 19 | static string filename; 20 | OpenFileDialog open; 21 | Image src; 22 | 23 | public FormFloodFill() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | private void button1_Click(object sender, EventArgs e) 29 | { 30 | open = new OpenFileDialog(); 31 | if (open.ShowDialog() == DialogResult.OK) 32 | { 33 | filename = open.FileName; 34 | imageBox1.Load(filename); 35 | src = new Image(open.FileName); 36 | } 37 | } 38 | 39 | private void button2_Click(object sender, EventArgs e) 40 | { 41 | FloodFilling(); 42 | } 43 | 44 | private void FloodFilling() 45 | { 46 | Image gray = src.Convert(); 47 | // CvInvoke.Threshold(gray, gray, 100, 255, Emgu.CV.CvEnum.ThresholdType.Binary); 48 | Rectangle rect = new Rectangle(); 49 | Mat mask=new Mat(src.Rows + 2,src.Cols + 2, DepthType.Cv8U,1); //初始化掩模mask 50 | CvInvoke.FloodFill(gray, //输入/输出1通道或3通道,8位或浮点图像。 51 | mask, //掩模,。它应该为单通道、8位、长和宽上都比输入图像 image 大两个像素点的图像 52 | new Point(50, 100), //漫水填充算法的起始点 53 | new MCvScalar(0, 0, 0),//像素点被染色的值,即在重绘区域像素的新值 54 | out rect, //用于设置floodFill函数将要重绘区域的最小边界矩形区域 55 | new MCvScalar(0, 0, 0),//表示当前观察像素值与其部件邻域像素值或者待加入该部件的种子像素之间的亮度或颜色之负差(lower brightness/color difference)的最大值 56 | new MCvScalar(100, 100, 100),//表示当前观察像素值与其部件邻域像素值或者待加入该部件的种子像素之间的亮度或颜色之正差(lower brightness/color difference)的最大值 57 | Connectivity.EightConnected, 58 | FloodFillType.Default //操作标志符 59 | );//将种子点所在的连通域内的 60 | //所有区域变成newVal 61 | 62 | imageBox2.Image = gray; 63 | } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormWarpPerspective.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 透视变换(Perspective Transformation)是指利用透视中心、 像点、 目标点 3 | 三点共线的条件, 按透视旋转定律使承影面(透视面) 绕迹线(透视轴) 旋 4 | 转某一角度, 破坏原有的投影光线束, 仍能保持承影面上投影几何图形不变 5 | 的变换。 6 | 透视变换常用于图象的校正, 例如在移动机器人视觉导航研究中, 由于 7 | 摄像机与地面之间有一倾斜角, 而不是直接垂直朝下(正投影), 有时希望 8 | 将图象校正成正投影的形式, 就需要利用透视变换。 9 | 透视变换采用 3*3 矩阵。 10 | */ 11 | 12 | using System; 13 | using System.Drawing; 14 | using System.Windows.Forms; 15 | using Emgu.CV; 16 | using Emgu.CV.Structure; 17 | 18 | namespace EmgucvDemo 19 | { 20 | public partial class FormWarpPerspective : Form 21 | { 22 | static string filename; 23 | OpenFileDialog open; 24 | Image src; 25 | Mat data = new Mat(); 26 | 27 | public FormWarpPerspective() 28 | { 29 | InitializeComponent(); 30 | } 31 | 32 | private void button1_Click(object sender, EventArgs e) 33 | { 34 | open = new OpenFileDialog(); 35 | if (open.ShowDialog() == DialogResult.OK) 36 | { 37 | filename = open.FileName; 38 | imageBox1.Load(filename); 39 | src = new Image(open.FileName); 40 | } 41 | } 42 | 43 | private void button2_Click(object sender, EventArgs e) 44 | { 45 | //创建用于获取透视的四个点坐标。 这四个点坐标与之前的坐标顺序倒序。 { 1, 2, 3, 4}=>{ 4,3,2,1} 46 | PointF[] point_src = new PointF[] { new PointF(0, 0), new PointF(src.Width, 0),new PointF(0, src.Height),new PointF(src.Width,src.Height)}; 47 | PointF[] point_dst = new PointF[] { new PointF(src.Width,src.Height),new PointF(0, src.Height), new PointF(src.Width, 0),new PointF(0, 0) }; 48 | data = CvInvoke.GetPerspectiveTransform(point_src, point_dst);//获取透视矩阵 49 | 50 | byte[,,] da = data.ToImage().Data; 51 | //获取仿射矩阵的像素值 52 | for (int i = 0; i < 3; i++) 53 | { 54 | for (int j = 0; j < 3; j++) 55 | { 56 | richTextBox1.Text += da[i, j, 0] + "\t"; 57 | } 58 | richTextBox1.Text += "\n"; 59 | } 60 | 61 | } 62 | 63 | private void button3_Click(object sender, EventArgs e) 64 | { 65 | Mat dstImage = new Mat(); 66 | CvInvoke.WarpPerspective(src, dstImage, data, src.Size);//进行透视操作。 67 | imageBox2.Image = dstImage; 68 | } 69 | 70 | private void button4_Click(object sender, EventArgs e) 71 | { 72 | 73 | 74 | // CvInvoke.PerspectiveTransform(src,data);//进行透视操作。 75 | 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBinary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Emgu.CV; 4 | using Emgu.CV.Structure; 5 | using Emgu.CV.CvEnum; 6 | 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormBinary : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | ThresholdType[] threshold_type = new ThresholdType[7] { ThresholdType.Binary, ThresholdType.BinaryInv, ThresholdType.Trunc, ThresholdType.ToZero, ThresholdType.ToZeroInv, ThresholdType.Mask, ThresholdType.Otsu }; 16 | AdaptiveThresholdType[] adaptive_threshold_type = new AdaptiveThresholdType[2] { AdaptiveThresholdType .GaussianC, AdaptiveThresholdType.MeanC}; 17 | 18 | public FormBinary() 19 | { 20 | InitializeComponent(); 21 | 22 | comboBox1.SelectedIndex = 1; 23 | comboBox2.SelectedIndex = 1; 24 | 25 | } 26 | 27 | private void button1_Click(object sender, EventArgs e) 28 | { 29 | open = new OpenFileDialog(); 30 | if (open.ShowDialog() == DialogResult.OK) 31 | { 32 | filename = open.FileName; 33 | imageBox1.Load(filename); 34 | src = new Image(open.FileName); 35 | } 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | Mat dst = new Mat(); 41 | double threshold = Convert.ToDouble(numericUpDown1.Value); 42 | double maxValue = Convert.ToDouble(numericUpDown2.Value); 43 | int i = comboBox1.SelectedIndex; 44 | CvInvoke.Threshold(src, dst, threshold, maxValue, threshold_type[i]); 45 | imageBox2.Image = dst; 46 | } 47 | 48 | private void button3_Click(object sender, EventArgs e) 49 | { 50 | Mat dst = new Mat(); 51 | double maxValue = Convert.ToDouble(numericUpDown2.Value); 52 | int i = comboBox1.SelectedIndex; 53 | int j = comboBox2.SelectedIndex; 54 | int blockSize = Convert.ToInt32(numericUpDown3.Value); 55 | double param1 = Convert.ToDouble(numericUpDown4.Value); 56 | CvInvoke.AdaptiveThreshold(src, dst, maxValue, 57 | adaptive_threshold_type[j], //— ADAPTIVE_THRESH_MEAN_C :领域内均值 ADAPTIVE_THRESH_GAUSSIAN_C :领域内像素点加权和,权 重为一个高斯窗口 58 | threshold_type[i], 59 | blockSize, //规定领域大小(一个正方形的领域) 60 | param1////阈值等于均值或者加权值减去这个常数(为0相当于阈值 就是求得领域内均值或者加权值)这种方法理论上得到的效果更好,相当于在动态自适应的调整属于自己像素点的阈值,而不是整幅图像都用一个阈值。 61 | ); 62 | imageBox2.Image = dst; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /EmgucvDemo/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace EmgucvDemo.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EmgucvDemo.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormWarpAffine.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 仿射变换可以通过一系列的原子变换的复合来实现, 3 | 包括: 平移(Translation)、 缩放(Scale)、 翻转(Flip)、 旋转(Rotation)和错切(Shear)。 4 | */ 5 | 6 | 7 | using System; 8 | using System.Drawing; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | 13 | namespace EmgucvDemo 14 | { 15 | public partial class FormWarpAffine : Form 16 | { 17 | static string filename; 18 | OpenFileDialog open; 19 | Image src; 20 | Mat data = new Mat(); 21 | 22 | public FormWarpAffine() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | 28 | 29 | private void button1_Click(object sender, EventArgs e) 30 | { 31 | open = new OpenFileDialog(); 32 | if (open.ShowDialog() == DialogResult.OK) 33 | { 34 | filename = open.FileName; 35 | imageBox1.Load(filename); 36 | src = new Image(open.FileName); 37 | } 38 | } 39 | 40 | //方法1获取仿射矩阵 41 | private void button2_Click(object sender, EventArgs e) 42 | { 43 | PointF[] point_src = new PointF[] { new PointF(0, 0), new PointF(90, 0), new PointF(0, 90)}; 44 | PointF[] point_dst = new PointF[] { new PointF(0, 0), new PointF(0, 90), new PointF(90, 0) }; 45 | data = CvInvoke.GetAffineTransform(point_src,point_dst); 46 | float[,,] da = data.ToImage().Data; 47 | //获取仿射矩阵的像素值 48 | for(int i = 0;i< 2;i++) 49 | { 50 | for(int j=0;j<3;j++) 51 | { 52 | richTextBox1.Text += da[i, j, 0] + "\t"; 53 | } 54 | richTextBox1.Text += "\n"; 55 | } 56 | 57 | } 58 | 59 | 60 | 61 | //方法2计算仿射矩阵 62 | private void button4_Click(object sender, EventArgs e) 63 | { 64 | 65 | PointF p = new PointF(Single.Parse(textBox1.Text), Single.Parse(textBox2.Text)); 66 | double angle = Double.Parse(textBox3.Text); 67 | double scale = Double.Parse(textBox4.Text); 68 | CvInvoke.GetRotationMatrix2D(p, angle, scale, data); 69 | float[,,] da = data.ToImage().Data; 70 | //获取仿射矩阵的像素值 71 | for (int i = 0; i < 2; i++) 72 | { 73 | for (int j = 0; j < 3; j++) 74 | { 75 | richTextBox2.Text += da[i, j, 0] + "\t"; 76 | } 77 | richTextBox2.Text += "\n"; 78 | } 79 | } 80 | 81 | 82 | private void button3_Click(object sender, EventArgs e) 83 | { 84 | Mat dstImage = new Mat(); 85 | CvInvoke.WarpAffine(src, dstImage,data,src.Size); 86 | imageBox2.Image = dstImage; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /EmgucvDemo/特征点/FormFeature.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | using Emgu.CV; 12 | using Emgu.CV.Structure; 13 | using Emgu.Util; 14 | using Emgu.CV.CvEnum; 15 | using Emgu.CV.Util; 16 | using Emgu.CV.Features2D; 17 | using Emgu.CV.XFeatures2D; 18 | 19 | namespace EmgucvDemo 20 | { 21 | public partial class FormFeature : Form 22 | { 23 | public FormFeature() 24 | { 25 | InitializeComponent(); 26 | } 27 | 28 | static string filename; 29 | OpenFileDialog open; 30 | Image src; 31 | Image dst; 32 | 33 | private void button1_Click(object sender, EventArgs e) 34 | { 35 | open = new OpenFileDialog(); 36 | if (open.ShowDialog() == DialogResult.OK) 37 | { 38 | filename = open.FileName; 39 | pictureBoxSrc.Load(filename); 40 | src = new Image(open.FileName); 41 | 42 | } 43 | } 44 | 45 | private void button2_Click(object sender, EventArgs e) 46 | { 47 | open = new OpenFileDialog(); 48 | if (open.ShowDialog() == DialogResult.OK) 49 | { 50 | filename = open.FileName; 51 | pictureBoxDst.Load(filename); 52 | dst = new Image(open.FileName); 53 | } 54 | } 55 | 56 | private void button3_Click(object sender, EventArgs e) 57 | { 58 | if (src != null && dst != null) 59 | { 60 | Image srcImg = src.Copy(); 61 | Image dstImg = dst.Copy(); 62 | long score; 63 | long matchTime; 64 | Point[] observedPoints = new Point[4]; 65 | using (Mat modelImage = dstImg.Mat) 66 | using (Mat observedImage = srcImg.Mat) 67 | { 68 | var result = DrawMatches.Draw(modelImage, observedImage, out matchTime, out score, out observedPoints); 69 | imageBox1.Image = result; 70 | 71 | if (score > Convert.ToInt32(numericUpDown1.Value)) 72 | { 73 | using (VectorOfPoint vp = new VectorOfPoint(observedPoints)) 74 | { 75 | CvInvoke.Polylines(src, vp, true, new MCvScalar(255, 0, 0, 255), 5); 76 | } 77 | pictureBoxSrc.Image = src.Bitmap; 78 | } 79 | } 80 | textBox1.Text = "score" + score + "," + "matchtime:" + matchTime; 81 | } 82 | } 83 | 84 | 85 | 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormAbsDiff.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Emgu.CV; 5 | using Emgu.CV.Structure; 6 | 7 | namespace EmgucvDemo 8 | { 9 | public partial class FormAbsDiff : Form 10 | { 11 | static string curFileNameSrc; 12 | static string curFileNameDst; 13 | Bitmap curBitmapSrc; 14 | Bitmap curBitmapDst; 15 | 16 | public FormAbsDiff() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | //载入图像img1 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | //Create open dialog; 25 | OpenFileDialog opnDlg = new OpenFileDialog(); 26 | opnDlg.Filter = "All Image files|*.bmp;*.gif;*.jpg;*.ico;*png"; 27 | //Seting the title of dialog; 28 | opnDlg.Title = "Open Src image files"; 29 | opnDlg.ShowHelp = true; 30 | if (opnDlg.ShowDialog() == DialogResult.OK) 31 | { 32 | curFileNameSrc = opnDlg.FileName; 33 | try 34 | { 35 | curBitmapSrc = new Bitmap(curFileNameSrc); 36 | imageBox1.Image = curBitmapSrc; 37 | } 38 | catch 39 | { 40 | MessageBox.Show("programe error"); 41 | } 42 | } 43 | } 44 | //载入图像img2 45 | private void button2_Click(object sender, EventArgs e) 46 | { 47 | //Create open dialog; 48 | OpenFileDialog opnDlg = new OpenFileDialog(); 49 | opnDlg.Filter = "All Image files|*.bmp;*.gif;*.jpg;*.ico;*png"; 50 | //Seting the title of dialog; 51 | opnDlg.Title = "Open Dst image files"; 52 | opnDlg.ShowHelp = true; 53 | if (opnDlg.ShowDialog() == DialogResult.OK) 54 | { 55 | curFileNameDst = opnDlg.FileName; 56 | try 57 | { 58 | curBitmapDst = new Bitmap(curFileNameDst); 59 | imageBox2.Image = curBitmapDst; 60 | } 61 | catch 62 | { 63 | MessageBox.Show("programe error"); 64 | } 65 | } 66 | } 67 | //相减计算 68 | private void button3_Click(object sender, EventArgs e) 69 | { 70 | Image curBitmapSrc_1 = new Image(curBitmapSrc); 71 | Image curBitmapDst_1= new Image(curBitmapDst); 72 | Image result = new Image(curBitmapSrc); 73 | //CvInvoke.cvCopy(img1, img_1, IntPtr.Zero); 74 | //CvInvoke.cvCopy(img2, img_2, IntPtr.Zero); 75 | 76 | 77 | 78 | result = curBitmapSrc_1.AbsDiff(curBitmapDst_1); 79 | pictureBox3.Image = result.Bitmap; 80 | 81 | } 82 | } 83 | 84 | } 85 | 86 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormROI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | using Emgu.CV.CvEnum; 13 | using Emgu.CV.UI; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormROI : Form 18 | { 19 | static string filename; 20 | OpenFileDialog open; 21 | Mat image; 22 | public FormROI() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void button2_Click(object sender, EventArgs e) 28 | { 29 | open = new OpenFileDialog(); 30 | if (open.ShowDialog() == DialogResult.OK) 31 | { 32 | filename = open.FileName; 33 | pictureBox1.Load(filename); 34 | image = new Mat(open.FileName,ImreadModes.AnyColor); 35 | } 36 | } 37 | 38 | private void button1_Click(object sender, EventArgs e) 39 | { 40 | Size maksSize = new Size(image.Width+2,image.Height+2); 41 | Mat mask = new Mat (maksSize, DepthType.Cv8U,1); 42 | Point center = new Point(200,200); ; 43 | int radius = 100; 44 | CvInvoke.Circle(mask, center, radius, new MCvScalar(255,255,255),2); 45 | pictureBox2.Image = mask.Bitmap; 46 | Point seed = new Point(center.X+1, center.Y+1); 47 | Rectangle rect = new Rectangle(); 48 | //漫水填充 49 | //pi的值表示为 v(pi),if v(seed)-loDiff image1;//创建Image 输入图片 15 | Image image2;//创建Image 输入图片 16 | Image image3;//创建Image 输入图片 17 | Image image4;//创建Image 输入图片 18 | 19 | public FormStitching() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void button1_Click(object sender, EventArgs e) 25 | { 26 | open = new OpenFileDialog(); 27 | if (open.ShowDialog() == DialogResult.OK) 28 | { 29 | filename = open.FileName; 30 | imageBox1.Load(filename); 31 | image1 = new Image(open.FileName); 32 | } 33 | } 34 | 35 | private void button2_Click(object sender, EventArgs e) 36 | { 37 | open = new OpenFileDialog(); 38 | if (open.ShowDialog() == DialogResult.OK) 39 | { 40 | filename = open.FileName; 41 | imageBox2.Load(filename); 42 | image2 = new Image(open.FileName); 43 | } 44 | } 45 | 46 | private void button3_Click(object sender, EventArgs e) 47 | { 48 | open = new OpenFileDialog(); 49 | if (open.ShowDialog() == DialogResult.OK) 50 | { 51 | filename = open.FileName; 52 | imageBox3.Load(filename); 53 | image3 = new Image(open.FileName); 54 | } 55 | } 56 | 57 | private void button4_Click(object sender, EventArgs e) 58 | { 59 | open = new OpenFileDialog(); 60 | if (open.ShowDialog() == DialogResult.OK) 61 | { 62 | filename = open.FileName; 63 | imageBox4.Load(filename); 64 | image4 = new Image(open.FileName); 65 | } 66 | } 67 | 68 | private void button5_Click(object sender, EventArgs e) 69 | { 70 | Stitcher _sticher = new Stitcher(Stitcher.Mode.Scans);//创建一个 Sticher 类。 71 | Mat result_image = new Mat();//创建 Mat 存储输出全景图 72 | VectorOfMat sti_image = new VectorOfMat();//创建 VectorOfMat 类型, 输入图像拼接数组 73 | // 添加图像到 sti_image 中, 不按照循序进行添加, 说明拼接图像与顺序无关*// 74 | sti_image.Push(image1); 75 | sti_image.Push(image2); 76 | sti_image.Push(image3); 77 | sti_image.Push(image4); 78 | Stitcher.Status status = _sticher.Stitch(sti_image, result_image);//进行图像拼接, 返回 bool 类型, 是否拼接成功。 79 | if (status == Stitcher.Status.Ok) 80 | imageBox5.Image = result_image;//显示图像。 81 | else 82 | MessageBox.Show("拼接失败", "提示"); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormOCR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using System.Windows.Forms; 4 | using Emgu.CV.Structure; 5 | using Emgu.CV; 6 | using Emgu.CV.OCR; 7 | 8 | 9 | namespace EmgucvDemo 10 | { 11 | public partial class FormOCR : Form 12 | { 13 | private Tesseract _ocr;//创建Tesseract 类 14 | static string filename; 15 | OpenFileDialog open; 16 | Image image;//创建Image 输入图片 17 | Image gray;//创建Image 灰度输入图片。 18 | 19 | public FormOCR() 20 | { 21 | InitializeComponent(); 22 | 23 | _ocr = new Tesseract();//实例化Tesseract 类。 24 | } 25 | 26 | private void button1_Click(object sender, EventArgs e) 27 | { 28 | open = new OpenFileDialog(); 29 | if (open.ShowDialog() == DialogResult.OK) 30 | { 31 | filename = open.FileName; 32 | imageBox1.Load(filename); 33 | image = new Image(open.FileName); 34 | gray = image.Convert(); 35 | } 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | 41 | string path = Application.StartupPath+"//";//申明数据源的路径,在运行目录的tessdata 文件夹下。 42 | string language = "";//申明选择语言。 43 | //*判断选择的语言*// 44 | if (checkBox1.Checked && checkBox2.Checked)//checkBox1 为识别英文。 45 | { 46 | language = "chi_sim+eng"; 47 | } 48 | else 49 | { 50 | if (checkBox2.Checked) 51 | { 52 | language = "chi_sim"; 53 | } 54 | else 55 | { 56 | language = "eng"; 57 | checkBox1.Checked = true; 58 | } 59 | } 60 | try 61 | { 62 | _ocr = new Tesseract("", language, OcrEngineMode.Default);//指定参数实例化tessdata 类。地址为空时,需将tessdata文件夹放在debug根目录 63 | _ocr.PageSegMode = PageSegMode.SingleBlock; 64 | _ocr.SetImage(gray); 65 | int result = _ocr.Recognize(); 66 | if (result != 0) 67 | { 68 | MessageBox.Show("识别失败!"); 69 | return; 70 | } 71 | Tesseract.Character[] characters = _ocr.GetCharacters();//获取识别数据 72 | //Bgr drawColor = new Bgr(Color.Blue);//创建Bgr 为蓝色。 73 | //foreach (Tesseract.Character c in characters)//遍历每个识别数据。 74 | //{ 75 | // image.Draw(c.Region, drawColor, 1);//绘制检测到的区域。 76 | //} 77 | //imageBox1.Image = image;//显示绘制矩形区域的图像 78 | String text = _ocr.GetUTF8Text();//得到识别字符串。 79 | richTextBox1.Text = text;//显示获取的字符串。 80 | } 81 | catch 82 | { 83 | MessageBox.Show("检查运行目录是否有语言包"); 84 | } 85 | } 86 | } 87 | } 88 | 89 | 90 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormTemplateMatch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Emgu.CV; 5 | using Emgu.CV.Structure; 6 | using Emgu.CV.Util; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormTemplateMatch : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image scr; 15 | Image temp; 16 | 17 | public FormTemplateMatch() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | open = new OpenFileDialog(); 25 | if (open.ShowDialog() == DialogResult.OK) 26 | { 27 | filename = open.FileName; 28 | imageBox1.Load(filename); 29 | scr = new Image(open.FileName); 30 | } 31 | } 32 | 33 | private void button2_Click(object sender, EventArgs e) 34 | { 35 | open = new OpenFileDialog(); 36 | if (open.ShowDialog() == DialogResult.OK) 37 | { 38 | filename = open.FileName; 39 | imageBox2.Load(filename); 40 | temp = new Image(open.FileName); 41 | } 42 | } 43 | 44 | private void button3_Click(object sender, EventArgs e) 45 | { 46 | Mat result = new Mat(new Size(scr.Width - temp.Width + 1, scr.Height - temp.Height + 1), Emgu.CV.CvEnum.DepthType.Cv8U, 1); 47 | //创建mat 存储输出匹配结果。 48 | CvInvoke.MatchTemplate(scr, temp, result, Emgu.CV.CvEnum.TemplateMatchingType.SqdiffNormed); //采用系数匹配法,匹配值越大越接近准确图像。 49 | CvInvoke.Normalize(result, result, 255, 0, Emgu.CV.CvEnum.NormType.MinMax); //把数据进行以最大值255 最小值0 进行归一化。 50 | result = result.ToImage().Mat;//result 类型转成Byte 类型。 51 | VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint(); //创建VectorOfVectorOfPoint 类型保存轮廓。 52 | int threshold = 180; //设置阈值。 53 | Mat data = new Mat();//创建data 存储阈值后的图像。 54 | while (true) 55 | { 56 | CvInvoke.Threshold(result, data, threshold, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv);//阈值操作。 57 | CvInvoke.FindContours(data, contours, null, Emgu.CV.CvEnum.RetrType.External, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple);// 存储轮廓。 58 | 59 | if (contours.Size <= 1)//判断匹配个数是否小于等于10 60 | { 61 | break; 62 | } 63 | threshold -= 2;//阈值降低 64 | 65 | } 66 | for (int i = 0; i < contours.Size; i++)//遍历每个连通域。 67 | { 68 | VectorOfPoint contour = contours[i]; 69 | 70 | Moments moment = CvInvoke.Moments(contour);//获得连通域的矩 71 | Point p = new Point((int)(moment.M10 / moment.M00), (int)(moment.M01 / moment.M00));// 获得连通域的中心 72 | CvInvoke.Rectangle(scr, new Rectangle(p, temp.Size), new MCvScalar(0, 0, 255), 4);//绘制匹配区域。 73 | } 74 | imageBox1.Image = scr ; 75 | 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormMorphology.cs: -------------------------------------------------------------------------------- 1 | using Emgu.CV; 2 | using Emgu.CV.Structure; 3 | using System; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | namespace EmgucvDemo 8 | { 9 | 10 | public partial class FormMorphology : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | 16 | Emgu.CV.CvEnum.MorphOp morphop; 17 | 18 | public FormMorphology() 19 | { 20 | InitializeComponent(); 21 | comboBox1.SelectedIndex = 0; 22 | } 23 | 24 | 25 | private void button1_Click(object sender, EventArgs e) 26 | { 27 | open = new OpenFileDialog(); 28 | if (open.ShowDialog() == DialogResult.OK) 29 | { 30 | filename = open.FileName; 31 | imageBox1.Load(filename); 32 | src = new Image(open.FileName); 33 | } 34 | } 35 | 36 | private void button7_Click(object sender, EventArgs e) 37 | { 38 | switch (comboBox1.SelectedIndex) 39 | { 40 | case 0: morphop = Emgu.CV.CvEnum.MorphOp.Erode;break; 41 | case 1: morphop = Emgu.CV.CvEnum.MorphOp.Dilate; break; 42 | case 2: morphop = Emgu.CV.CvEnum.MorphOp.Open; break; 43 | case 3: morphop = Emgu.CV.CvEnum.MorphOp.Close; break; 44 | case 4: morphop = Emgu.CV.CvEnum.MorphOp.Gradient; break; 45 | case 5: morphop = Emgu.CV.CvEnum.MorphOp.Tophat; break; 46 | case 6: morphop = Emgu.CV.CvEnum.MorphOp.Blackhat; break; 47 | default:break; 48 | } 49 | //开运算(Opening Operation):先腐蚀后膨胀. 50 | //开运算可以用来消除小物体、在纤细点处分离物体、平滑较大物体的边界的同时并不明显改变其面积 51 | Image dst = src.CopyBlank(); 52 | //定义内核的大小和形状,一般情况Size里的值为Point里对应的是的两倍加1 53 | Mat element = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Rectangle, new Size(5, 5), new Point(2, 2)); 54 | CvInvoke.MorphologyEx(src, dst, morphop, element, new Point(1, 1), 1, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(255, 0, 0, 255)); 55 | //0:Erode腐蚀就是原图中的高亮部分被腐蚀,“领域被蚕食”,效果图拥有比原图更小的高亮区域。 56 | //1:Dilate膨胀就是图像中的高亮部分进行膨胀,“领域扩张”,效果图拥有比原图更大的高亮区域。 57 | //2:Open //开运算(Opening Operation):先腐蚀后膨胀. 58 | //开运算可以用来消除小物体、在纤细点处分离物体、平滑较大物体的边界的同时并不明显改变其面积 59 | //3:Close 闭运算(Closing Operation):先膨胀后腐蚀. 60 | //闭运算能够排除小型黑洞(黑色区域) 61 | //4:Gradient//形态学梯度(Morphological Gradient):为膨胀图与腐蚀图之差. 62 | //对二值图像进行这一操作可以将团块(blob)的边缘突出出来。我们可以用形态学梯度来保留物体的边缘轮廓 63 | //5:Tophat //顶帽运算(Top Hat):又常常被译为”礼帽“运算。为原图像与“开运算“的结果图之差 64 | //为开运算带来的结果是放大了裂缝或者局部低亮度的区域,因此,从原图中减去开运算后的图,得到的效果图突出了比原图轮廓周围的区域更明亮的区域,且这一操作和选择的核的大小相关。 65 | //顶帽运算往往用来分离比邻近点亮一些的斑块。当一幅图像具有大幅的背景的时候,而微小物品比较有规律的情况下,可以使用顶帽运算进行背景提取。 66 | //6:Blackhat //黑帽(Black Hat)运算: 为”闭运算“的结果图与原图像之差。 67 | //黑帽运算后的效果图突出了比原图轮廓周围的区域更暗的区域,且这一操作和选择的核的大小相关。 68 | //所以,黑帽运算用来分离比邻近点暗一些的斑块 69 | imageBox2.Image = dst; 70 | 71 | 72 | } 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBackProjection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Util; 12 | using Emgu.CV.Structure; 13 | using Emgu.CV.CvEnum; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormBackProjection : Form 18 | { 19 | static string filename; 20 | OpenFileDialog open; 21 | Image bgrImage; 22 | Image hsvImage; 23 | Image hueImage; 24 | int g_bins = 30;//直方图组距 25 | 26 | public FormBackProjection() 27 | { 28 | InitializeComponent(); 29 | } 30 | 31 | private void button1_Click(object sender, EventArgs e) 32 | { 33 | open = new OpenFileDialog(); 34 | if (open.ShowDialog() == DialogResult.OK) 35 | { 36 | filename = open.FileName; 37 | imageBox1.Load(filename); 38 | bgrImage = new Image(open.FileName); 39 | hsvImage = bgrImage.Convert(); 40 | } 41 | } 42 | 43 | private void button2_Click(object sender, EventArgs e) 44 | { 45 | 46 | int[] ch = { 0, 0 }; 47 | CvInvoke.MixChannels(hsvImage,hueImage,ch); 48 | //【2】直方图计算,并归一化 49 | float[] hue_range = new float[2] { 0.00f, 180.00f }; 50 | Mat hist = new Mat(hueImage.Size, Emgu.CV.CvEnum.DepthType.Cv8U, 1); 51 | int[] channels = new int[1] { 0 }; 52 | int[] histSize = new int[1] { Math.Max(g_bins, 2) }; 53 | float[] ranges = new float[2] { 0, 180 }; 54 | CvInvoke.CalcHist(hueImage, channels,null, hist, histSize, ranges, true); 55 | CvInvoke.Normalize(hist, hist,0,255,NormType.MinMax,DepthType.Default,null); 56 | //【3】计算反向投影 57 | Mat backproj=new Mat(); 58 | CvInvoke.CalcBackProject(hueImage,channels,hist,backproj,ranges,1); 59 | //【4】显示反向投影 60 | imageBox2.Image = backproj; 61 | //【5】绘制直方图 62 | Image img = new Image(hist.Bitmap); 63 | float[] data = new float[img.Data.Length]; 64 | for (int i = 0; i < img.Data.Length; i++) 65 | { 66 | data[i] = img.Data[i, 0, 0]; 67 | } 68 | float max = data[0]; 69 | //获取最大值 70 | for (int i = 1; i < data.Length; i++) 71 | { 72 | if (data[i] > max) 73 | { 74 | max = data[i]; 75 | } 76 | } 77 | Image image = new Image(300, 300, new Bgr(0, 0, 0)); 78 | 79 | for (int i = 0; i < data.Length; i++) 80 | { 81 | data[i] = data[i] * 256 / max; 82 | image.Draw(new LineSegment2DF(new PointF(i + 20, 255), new PointF(i + 21, 255 - data[i])), new Bgr(255, 255, 255), 2); 83 | } 84 | imageBox3.Image = image; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormHull.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.Util; 12 | using Emgu.CV.Structure; 13 | using Emgu.CV.CvEnum; 14 | 15 | namespace EmgucvDemo 16 | { 17 | public partial class FormHull : Form 18 | { 19 | static string filename; 20 | OpenFileDialog open; 21 | Image image1; 22 | public FormHull() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void button1_Click(object sender, EventArgs e) 28 | { 29 | open = new OpenFileDialog(); 30 | if (open.ShowDialog() == DialogResult.OK) 31 | { 32 | filename = open.FileName; 33 | imageBox1.Load(filename); 34 | image1 = new Image(open.FileName); 35 | } 36 | } 37 | 38 | private void button2_Click(object sender, EventArgs e) 39 | { 40 | Image image2 = new Image(image1.Width, image1.Height); 41 | Image image3 = new Image(image1.Width, image1.Height); 42 | Image image4 = new Image(image1.Width, image1.Height); 43 | CvInvoke.Canny(image1, image2, 100, 60); 44 | VectorOfVectorOfPoint con = new VectorOfVectorOfPoint(); 45 | CvInvoke.FindContours(image2, con, image3, RetrType.Ccomp, ChainApproxMethod.ChainApproxSimple); 46 | 47 | Point[][] con1 = con.ToArrayOfArray(); 48 | PointF[][] con2 = Array.ConvertAll(con1, new Converter(PointToPointF)); 49 | for (int i = 0; i < con.Size; i++) 50 | { 51 | PointF[] hull = CvInvoke.ConvexHull(con2[i], true); 52 | for (int j = 0; j < hull.Length; j++) 53 | { 54 | Point p1 = new Point((int)(hull[j].X + 0.5), (int)(hull[j].Y + 0.5)); 55 | Point p2; 56 | if (j == hull.Length - 1) 57 | p2 = new Point((int)(hull[0].X + 0.5), (int)(hull[0].Y + 0.5)); 58 | else 59 | p2 = new Point((int)(hull[j + 1].X + 0.5), (int)(hull[j + 1].Y + 0.5)); 60 | CvInvoke.Circle(image4, p1, 3, new MCvScalar(0, 255, 255, 255), 6); 61 | CvInvoke.Line(image4, p1, p2, new MCvScalar(255, 255, 0, 255), 3); 62 | } 63 | } 64 | for (int i = 0; i < con.Size; i++) 65 | CvInvoke.DrawContours(image4, con, i, new MCvScalar(255, 0, 255, 255), 2); 66 | 67 | imageBox2.Image = image1.ConcateVertical(image4); 68 | } 69 | 70 | public static PointF[] PointToPointF(Point[] pf) 71 | { 72 | PointF[] aaa = new PointF[pf.Length]; 73 | int num = 0; 74 | foreach (var point in pf) 75 | { 76 | aaa[num].X = (int)point.X; 77 | aaa[num++].Y = (int)point.Y; 78 | } 79 | return aaa; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBlob.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Emgu.CV; 5 | using Emgu.CV.Structure; 6 | using Emgu.CV.Features2D; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormBlob : Form 11 | { 12 | public FormBlob() 13 | { 14 | InitializeComponent(); 15 | } 16 | static string filename; 17 | OpenFileDialog open; 18 | Image img; 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | open = new OpenFileDialog(); 23 | if (open.ShowDialog() == DialogResult.OK) 24 | { 25 | filename = open.FileName; 26 | imageBox1.Load(filename); 27 | } 28 | } 29 | 30 | private void button2_Click(object sender, EventArgs e) 31 | { 32 | img = new Image(open.FileName); 33 | Image imgGray = img.Convert(); 34 | /* blob detector */ 35 | //Gray Gavg = imgGray.GetAverage(); 36 | double minValue = 255; 37 | double maxValue = 0; 38 | Point minLoc = new Point(); 39 | Point maxLoc = new Point(); 40 | CvInvoke.MinMaxLoc(imgGray, ref minValue, ref maxValue, ref minLoc, ref maxLoc); 41 | 42 | SimpleBlobDetectorParams blobparams = new SimpleBlobDetectorParams(); 43 | blobparams.FilterByArea = true; //斑点面积的限制变量 44 | blobparams.MinArea = 2000;// 斑点的最小面积 45 | blobparams.MaxArea = 300000;// 斑点的最大面积 46 | blobparams.MinThreshold = (float)minValue + 1; //二值化的起始阈值,即公式1的T1 47 | blobparams.MaxThreshold = (float)maxValue; //二值化的终止阈值,即公式1的T2 48 | blobparams.FilterByCircularity = true; ////斑点圆度的限制变量,默认是不限制 49 | blobparams.MinCircularity = (float)0.5;//斑点的最小圆度 50 | blobparams.MaxCircularity = 1;//斑点的最大圆度 51 | blobparams.FilterByConvexity = true; //斑点凸度的限制变量 52 | blobparams.MinConvexity = (float)0.8;//斑点的最小凸度 53 | blobparams.MaxConvexity = 10;//斑点的最大凸度 54 | blobparams.FilterByInertia = true; // //斑点惯性率的限制变量 55 | blobparams.MinInertiaRatio = (float)0.4;//斑点的最小惯性率 56 | blobparams.MaxInertiaRatio = 1;//斑点的最大惯性率 57 | blobparams.FilterByColor = false; //斑点颜色的限制变量 58 | blobparams.blobColor = 255; //斑点颜色的限制变量 59 | blobparams.ThresholdStep = 135;//二值化的阈值步长,即公式1的t 60 | blobparams.MinRepeatability = new IntPtr(2); //重复的最小次数,只有属于灰度图像斑点的那些二值图像斑点数量大于该值时,该灰度图像斑点才被认为是特征点 61 | SimpleBlobDetector detector = new SimpleBlobDetector(blobparams); 62 | 63 | MKeyPoint[] keypoints = detector.Detect(imgGray); 64 | Image imgBgr = img.Copy(); 65 | 66 | foreach (MKeyPoint keypoint in keypoints) 67 | { 68 | imgBgr.Draw(new Rectangle((int)(keypoint.Point.X - keypoint.Size / 2), (int)(keypoint.Point.Y - keypoint.Size / 2), (int)keypoint.Size, (int)keypoint.Size), new Bgr(255, 0, 0), 1); 69 | imageBox2.Image = imgBgr; 70 | } 71 | } 72 | 73 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 74 | { 75 | 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCorner.cs: -------------------------------------------------------------------------------- 1 | //角点检测分类: 2 | //<1>基于灰度图像的角点检测 3 | //<2> 基于二值图像的角点检测 4 | //<3>基于轮廓曲线的角点检测 5 | //而基于灰度图像的角点检测又可分为基于梯度、基于模板和基于模板梯度组合三类方法, 6 | //其中基于模板的方法主要考虑像素领域点的灰度变化,即图像亮度的变化,将与邻点亮度对比足够大的点定义为角点。 7 | //常见的基于模板的角点检测算法有Kitchen-Rosenfeld角点检测算法,Harris角点检测算法、KLT角点检测算法及SUSAN角点检测算法。 8 | //和其他角点检测算法相比,SUSAN角点检测算法具有算法简单、位置准确、抗噪声能力强等特点。 9 | 10 | using Emgu.CV; 11 | using Emgu.CV.Structure; 12 | using System; 13 | using System.Drawing; 14 | using System.Windows.Forms; 15 | 16 | namespace EmgucvDemo 17 | { 18 | public partial class FormCorner : Form 19 | { 20 | static string filename; 21 | OpenFileDialog open; 22 | Image src; 23 | 24 | public FormCorner() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | 30 | private void button1_Click(object sender, EventArgs e) 31 | { 32 | open = new OpenFileDialog(); 33 | if (open.ShowDialog() == DialogResult.OK) 34 | { 35 | filename = open.FileName; 36 | imageBox1.Load(filename); 37 | src = new Image(open.FileName); 38 | } 39 | } 40 | int thresh = 30; //当前阈值 41 | int max_thresh = 175; //最大阈值 42 | 43 | private void button2_Click(object sender, EventArgs e) 44 | { 45 | //---------------------------【1】定义一些局部变量----------------------------- 46 | Image dstImage=new Image(src.Size);//目标图 47 | Mat normImage=new Mat();//归一化后的图 48 | Image scaledImage=new Image(src.Size);//线性变换后的八位无符号整型的图 49 | 50 | //---------------------------【2】初始化--------------------------------------- 51 | //置零当前需要显示的两幅图,即清除上一次调用此函数时他们的值 52 | 53 | Image g_srcImage1 = src.Clone(); 54 | 55 | //---------------------------【3】正式检测------------------------------------- 56 | //进行角点检测 点检测传出的为Float类型的数据 57 | CvInvoke.CornerHarris(src, dstImage, 2); 58 | 59 | // 归一化与转换 60 | CvInvoke.Normalize(dstImage, normImage, 0, 255, Emgu.CV.CvEnum.NormType.MinMax); 61 | double min = 0, max = 0; 62 | Point minp = new Point(0, 0); 63 | Point maxp = new Point(0, 0); 64 | CvInvoke.MinMaxLoc(normImage, ref min, ref max, ref minp, ref maxp); 65 | double scale = 255 / (max - min); 66 | double shift = min * scale; 67 | CvInvoke.ConvertScaleAbs(normImage, scaledImage, scale, shift);//将归一化后的图线性变换成8位无符号整型 68 | 69 | //---------------------------【4】进行绘制------------------------------------- 70 | // 将检测到的,且符合阈值条件的角点绘制出来 71 | byte[] data = scaledImage.Bytes; 72 | for (int j = 0; j < normImage.Rows; j++) 73 | { 74 | for (int i = 0; i < normImage.Cols; i++) 75 | { 76 | int k = i * src.Width + j; 77 | if (k < data.Length) 78 | { 79 | if (data[k] > thresh) 80 | { 81 | CvInvoke.Circle(g_srcImage1, new Point(i, j), 5, new MCvScalar(10, 10, 255), 2); 82 | CvInvoke.Circle(scaledImage, new Point(i, j), 5, new MCvScalar(0, 10, 255), 2); 83 | } 84 | } 85 | } 86 | } 87 | imageBox1.Image=g_srcImage1; 88 | imageBox2.Image = scaledImage; 89 | } 90 | 91 | 92 | 93 | 94 | 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /EmgucvDemo/FormLicensePlate.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace OpenCVDemo 2 | { 3 | partial class FormLicensePlate 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 36 | this.SuspendLayout(); 37 | // 38 | // button1 39 | // 40 | this.button1.Location = new System.Drawing.Point(58, 43); 41 | this.button1.Name = "button1"; 42 | this.button1.Size = new System.Drawing.Size(75, 52); 43 | this.button1.TabIndex = 0; 44 | this.button1.Text = "加载图像"; 45 | this.button1.UseVisualStyleBackColor = true; 46 | this.button1.Click += new System.EventHandler(this.button1_Click); 47 | // 48 | // imageBox1 49 | // 50 | this.imageBox1.Location = new System.Drawing.Point(196, 43); 51 | this.imageBox1.Name = "imageBox1"; 52 | this.imageBox1.Size = new System.Drawing.Size(460, 369); 53 | this.imageBox1.TabIndex = 2; 54 | this.imageBox1.TabStop = false; 55 | // 56 | // button2 57 | // 58 | this.button2.Location = new System.Drawing.Point(58, 131); 59 | this.button2.Name = "button2"; 60 | this.button2.Size = new System.Drawing.Size(75, 52); 61 | this.button2.TabIndex = 3; 62 | this.button2.Text = "车牌识别"; 63 | this.button2.UseVisualStyleBackColor = true; 64 | this.button2.Click += new System.EventHandler(this.button2_Click); 65 | // 66 | // FormLicensePlate 67 | // 68 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 69 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 70 | this.ClientSize = new System.Drawing.Size(749, 483); 71 | this.Controls.Add(this.button2); 72 | this.Controls.Add(this.imageBox1); 73 | this.Controls.Add(this.button1); 74 | this.Name = "FormLicensePlate"; 75 | this.Text = "FormLicensePlate"; 76 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 77 | this.ResumeLayout(false); 78 | 79 | } 80 | 81 | #endregion 82 | 83 | private System.Windows.Forms.Button button1; 84 | private Emgu.CV.UI.ImageBox imageBox1; 85 | private System.Windows.Forms.Button button2; 86 | } 87 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormContour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using Emgu.CV; 4 | using Emgu.CV.Structure; 5 | using Emgu.CV.CvEnum; 6 | using Emgu.CV.Util; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormContour : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | 16 | double threshold_value; 17 | ThresholdType[] threshs = new ThresholdType[7] { ThresholdType.Binary, ThresholdType.BinaryInv, ThresholdType.Trunc, ThresholdType.ToZero, ThresholdType.ToZeroInv, ThresholdType.Mask, ThresholdType.Otsu}; 18 | RetrType[] perttypes = new RetrType[4] { RetrType.External, RetrType.List, RetrType.Ccomp , RetrType.Tree}; 19 | ChainApproxMethod [] chain_appox_methods = new ChainApproxMethod[6] { ChainApproxMethod.ChainCode, ChainApproxMethod.ChainApproxNone, ChainApproxMethod.ChainApproxSimple, ChainApproxMethod.ChainApproxTc89L1, ChainApproxMethod.ChainApproxTc89Kcos, ChainApproxMethod.LinkRuns }; 20 | bool isCouterFind = false; 21 | int minArea; 22 | int maxArea; 23 | 24 | 25 | public FormContour() 26 | { 27 | InitializeComponent(); 28 | } 29 | private void Form1_Load(object sender, EventArgs e) 30 | { 31 | comboBox1.SelectedIndex = 1; 32 | 33 | } 34 | private void button1_Click(object sender, EventArgs e) 35 | { 36 | open = new OpenFileDialog(); 37 | if (open.ShowDialog() == DialogResult.OK) 38 | { 39 | filename = open.FileName; 40 | imageBox1.Load(filename); 41 | src = new Image(open.FileName); 42 | } 43 | } 44 | 45 | private void button2_Click(object sender, EventArgs e) 46 | { 47 | minArea = Convert.ToInt32(numericUpDown1.Value); 48 | maxArea = Convert.ToInt32(numericUpDown2.Value); 49 | threshold_value = Convert.ToDouble(numericUpDown3.Value); 50 | test(src); 51 | } 52 | 53 | private void test(Image img) 54 | { 55 | int n =Convert.ToInt32(comboBox1.SelectedIndex ); 56 | 57 | isCouterFind = false; 58 | //Image Dyncontour = new Image(src.Size); 59 | //VectorOfVectorOfPoint use_Dyncontour = new VectorOfVectorOfPoint(); 60 | //VectorOfVectorOfPoint Dynstorage = new VectorOfVectorOfPoint(); 61 | 62 | Mat dst1 = new Mat(); 63 | CvInvoke.Threshold(img, dst1, threshold_value, 255,threshs[n]); 64 | // imageBox2.Image = dst1.Bitmap; 65 | VectorOfVectorOfPoint vvp = new VectorOfVectorOfPoint(); 66 | VectorOfVectorOfPoint use_vvp = new VectorOfVectorOfPoint(); 67 | CvInvoke.FindContours(dst1, vvp, null, Emgu.CV.CvEnum.RetrType.List, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxSimple); 68 | int number = vvp.ToArrayOfArray().Length;//取得轮廓的数量. 69 | 70 | for (int i = 0; i < number; i++) 71 | { 72 | VectorOfPoint vp = vvp[i]; 73 | double area = CvInvoke.ContourArea(vp); 74 | if (area > minArea && area < maxArea)//可按实际图片修改 75 | { 76 | use_vvp.Push(vp); 77 | } 78 | } 79 | if (use_vvp.Size > 0) 80 | { 81 | Mat result = new Mat(img.Size, Emgu.CV.CvEnum.DepthType.Cv8U, 3); 82 | result.SetTo(new MCvScalar(0, 0, 0)); 83 | CvInvoke.DrawContours(result, use_vvp, -1, new MCvScalar(0, 255, 0)); 84 | 85 | imageBox2.Image = result; 86 | 87 | } 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCapture .Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormCapture 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 33 | this.button1 = new System.Windows.Forms.Button(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 36 | this.SuspendLayout(); 37 | // 38 | // imageBox1 39 | // 40 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 41 | this.imageBox1.Location = new System.Drawing.Point(43, 113); 42 | this.imageBox1.Name = "imageBox1"; 43 | this.imageBox1.Size = new System.Drawing.Size(369, 331); 44 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 45 | this.imageBox1.TabIndex = 2; 46 | this.imageBox1.TabStop = false; 47 | // 48 | // button1 49 | // 50 | this.button1.Location = new System.Drawing.Point(70, 37); 51 | this.button1.Name = "button1"; 52 | this.button1.Size = new System.Drawing.Size(75, 44); 53 | this.button1.TabIndex = 3; 54 | this.button1.Text = "打开摄像头"; 55 | this.button1.UseVisualStyleBackColor = true; 56 | this.button1.Click += new System.EventHandler(this.button1_Click); 57 | // 58 | // button2 59 | // 60 | this.button2.Location = new System.Drawing.Point(180, 37); 61 | this.button2.Name = "button2"; 62 | this.button2.Size = new System.Drawing.Size(75, 44); 63 | this.button2.TabIndex = 4; 64 | this.button2.Text = "暂停"; 65 | this.button2.UseVisualStyleBackColor = true; 66 | this.button2.Click += new System.EventHandler(this.button2_Click); 67 | // 68 | // FormCapture 69 | // 70 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 72 | this.ClientSize = new System.Drawing.Size(807, 520); 73 | this.Controls.Add(this.button2); 74 | this.Controls.Add(this.button1); 75 | this.Controls.Add(this.imageBox1); 76 | this.Name = "FormCapture"; 77 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 78 | this.Text = "FormCapture"; 79 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 80 | this.ResumeLayout(false); 81 | 82 | } 83 | 84 | #endregion 85 | 86 | private Emgu.CV.UI.ImageBox imageBox1; 87 | private System.Windows.Forms.Button button1; 88 | private System.Windows.Forms.Button button2; 89 | } 90 | } -------------------------------------------------------------------------------- /EmgucvDemo/LicensePlateRecognition/FormLicensePlate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using Emgu.CV; 11 | using Emgu.CV.CvEnum; 12 | using Emgu.CV.Structure; 13 | using Emgu.CV.UI; 14 | 15 | using System.Diagnostics; 16 | using Emgu.CV.Util; 17 | 18 | namespace EmgucvDemo 19 | { 20 | public partial class FormLicensePlate : Form 21 | { 22 | private LicensePlateDetector _licensePlateDetector; 23 | UMat uImg; 24 | public FormLicensePlate() 25 | { 26 | InitializeComponent(); 27 | _licensePlateDetector = new LicensePlateDetector(""); 28 | //Mat m = new Mat("license-plate.jpg"); 29 | //UMat um = m.GetUMat(AccessType.ReadWrite); 30 | //imageBox1.Image = um; 31 | //ProcessImage(m); 32 | } 33 | 34 | private void ProcessImage(IInputOutputArray image) 35 | { 36 | Stopwatch watch = Stopwatch.StartNew(); // time the detection process 37 | 38 | List licensePlateImagesList = new List(); 39 | List filteredLicensePlateImagesList = new List(); 40 | List licenseBoxList = new List(); 41 | List words = _licensePlateDetector.DetectLicensePlate( 42 | image, 43 | licensePlateImagesList, 44 | filteredLicensePlateImagesList, 45 | licenseBoxList); 46 | 47 | watch.Stop(); //stop the timer 48 | processTimeLabel.Text = String.Format("License Plate Recognition time: {0} milli-seconds", watch.Elapsed.TotalMilliseconds); 49 | 50 | panel1.Controls.Clear(); 51 | Point startPoint = new Point(10, 10); 52 | for (int i = 0; i < words.Count; i++) 53 | { 54 | Mat dest = new Mat(); 55 | CvInvoke.VConcat(licensePlateImagesList[i], filteredLicensePlateImagesList[i], dest); 56 | AddLabelAndImage( 57 | ref startPoint, 58 | String.Format("License: {0}", words[i]), 59 | dest); 60 | PointF[] verticesF = licenseBoxList[i].GetVertices(); 61 | Point[] vertices = Array.ConvertAll(verticesF, Point.Round); 62 | using (VectorOfPoint pts = new VectorOfPoint(vertices)) 63 | CvInvoke.Polylines(image, pts, true, new Bgr(Color.Red).MCvScalar, 2); 64 | 65 | } 66 | 67 | } 68 | 69 | private void AddLabelAndImage(ref Point startPoint, String labelText, Mat image) 70 | { 71 | Label label = new Label(); 72 | panel1.Controls.Add(label); 73 | label.Text = labelText; 74 | label.Width = 100; 75 | label.Height = 30; 76 | label.Location = startPoint; 77 | startPoint.Y += label.Height; 78 | 79 | ImageBox box = new ImageBox(); 80 | panel1.Controls.Add(box); 81 | box.ClientSize = image.Size; 82 | box.Image = image; 83 | box.Location = startPoint; 84 | startPoint.Y += box.Height + 10; 85 | } 86 | 87 | private void button1_Click(object sender, EventArgs e) 88 | { 89 | DialogResult result = openFileDialog1.ShowDialog(); 90 | if (result == DialogResult.OK) 91 | { 92 | Mat img; 93 | try 94 | { 95 | img = CvInvoke.Imread(openFileDialog1.FileName); 96 | 97 | } 98 | catch 99 | { 100 | MessageBox.Show(String.Format("Invalide File: {0}", openFileDialog1.FileName)); 101 | return; 102 | } 103 | uImg = img.GetUMat(AccessType.ReadWrite); 104 | imageBox1.Image = uImg; 105 | } 106 | } 107 | 108 | 109 | private void button2_Click(object sender, EventArgs e) 110 | { 111 | ProcessImage(uImg); 112 | 113 | } 114 | 115 | private void FormLicensePlate_FormClosing(object sender, FormClosingEventArgs e) 116 | { 117 | e.Cancel=true; 118 | this.Hide(); 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCorner.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormCorner 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 35 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 36 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // button1 41 | // 42 | this.button1.Location = new System.Drawing.Point(56, 27); 43 | this.button1.Name = "button1"; 44 | this.button1.Size = new System.Drawing.Size(75, 53); 45 | this.button1.TabIndex = 3; 46 | this.button1.Text = "加载照片"; 47 | this.button1.UseVisualStyleBackColor = true; 48 | this.button1.Click += new System.EventHandler(this.button1_Click); 49 | // 50 | // button2 51 | // 52 | this.button2.Location = new System.Drawing.Point(147, 27); 53 | this.button2.Name = "button2"; 54 | this.button2.Size = new System.Drawing.Size(75, 53); 55 | this.button2.TabIndex = 4; 56 | this.button2.Text = "Harris角点检测"; 57 | this.button2.UseVisualStyleBackColor = true; 58 | this.button2.Click += new System.EventHandler(this.button2_Click); 59 | // 60 | // imageBox1 61 | // 62 | this.imageBox1.Location = new System.Drawing.Point(12, 114); 63 | this.imageBox1.Name = "imageBox1"; 64 | this.imageBox1.Size = new System.Drawing.Size(313, 275); 65 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 66 | this.imageBox1.TabIndex = 2; 67 | this.imageBox1.TabStop = false; 68 | // 69 | // imageBox2 70 | // 71 | this.imageBox2.Location = new System.Drawing.Point(344, 114); 72 | this.imageBox2.Name = "imageBox2"; 73 | this.imageBox2.Size = new System.Drawing.Size(313, 275); 74 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 75 | this.imageBox2.TabIndex = 5; 76 | this.imageBox2.TabStop = false; 77 | // 78 | // FormCorner 79 | // 80 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 81 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 82 | this.ClientSize = new System.Drawing.Size(708, 413); 83 | this.Controls.Add(this.imageBox2); 84 | this.Controls.Add(this.imageBox1); 85 | this.Controls.Add(this.button2); 86 | this.Controls.Add(this.button1); 87 | this.Name = "FormCorner"; 88 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 89 | this.Text = "角点"; 90 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 91 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 92 | this.ResumeLayout(false); 93 | 94 | } 95 | 96 | #endregion 97 | 98 | private System.Windows.Forms.Button button1; 99 | private System.Windows.Forms.Button button2; 100 | private Emgu.CV.UI.ImageBox imageBox1; 101 | private Emgu.CV.UI.ImageBox imageBox2; 102 | } 103 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormHull.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormHull 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 35 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 36 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // button1 41 | // 42 | this.button1.Location = new System.Drawing.Point(42, 33); 43 | this.button1.Name = "button1"; 44 | this.button1.Size = new System.Drawing.Size(75, 47); 45 | this.button1.TabIndex = 0; 46 | this.button1.Text = "加载图像"; 47 | this.button1.UseVisualStyleBackColor = true; 48 | this.button1.Click += new System.EventHandler(this.button1_Click); 49 | // 50 | // button2 51 | // 52 | this.button2.Location = new System.Drawing.Point(165, 33); 53 | this.button2.Name = "button2"; 54 | this.button2.Size = new System.Drawing.Size(75, 47); 55 | this.button2.TabIndex = 1; 56 | this.button2.Text = "凸包检测"; 57 | this.button2.UseVisualStyleBackColor = true; 58 | this.button2.Click += new System.EventHandler(this.button2_Click); 59 | // 60 | // imageBox1 61 | // 62 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 63 | this.imageBox1.Location = new System.Drawing.Point(12, 123); 64 | this.imageBox1.Name = "imageBox1"; 65 | this.imageBox1.Size = new System.Drawing.Size(425, 331); 66 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 67 | this.imageBox1.TabIndex = 3; 68 | this.imageBox1.TabStop = false; 69 | // 70 | // imageBox2 71 | // 72 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 73 | this.imageBox2.Location = new System.Drawing.Point(443, 123); 74 | this.imageBox2.Name = "imageBox2"; 75 | this.imageBox2.Size = new System.Drawing.Size(425, 331); 76 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 77 | this.imageBox2.TabIndex = 4; 78 | this.imageBox2.TabStop = false; 79 | // 80 | // FormHull 81 | // 82 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 | this.ClientSize = new System.Drawing.Size(888, 496); 85 | this.Controls.Add(this.imageBox2); 86 | this.Controls.Add(this.imageBox1); 87 | this.Controls.Add(this.button2); 88 | this.Controls.Add(this.button1); 89 | this.Name = "FormHull"; 90 | this.Text = "FormHull"; 91 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 92 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 93 | this.ResumeLayout(false); 94 | 95 | } 96 | 97 | #endregion 98 | 99 | private System.Windows.Forms.Button button1; 100 | private System.Windows.Forms.Button button2; 101 | private Emgu.CV.UI.ImageBox imageBox1; 102 | private Emgu.CV.UI.ImageBox imageBox2; 103 | } 104 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormRemap.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormRemap 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 34 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 35 | this.button2 = new System.Windows.Forms.Button(); 36 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // button1 41 | // 42 | this.button1.Location = new System.Drawing.Point(39, 30); 43 | this.button1.Name = "button1"; 44 | this.button1.Size = new System.Drawing.Size(75, 48); 45 | this.button1.TabIndex = 4; 46 | this.button1.Text = "加载图像"; 47 | this.button1.UseVisualStyleBackColor = true; 48 | this.button1.Click += new System.EventHandler(this.button1_Click); 49 | // 50 | // imageBox2 51 | // 52 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 53 | this.imageBox2.Location = new System.Drawing.Point(311, 113); 54 | this.imageBox2.Name = "imageBox2"; 55 | this.imageBox2.Size = new System.Drawing.Size(293, 246); 56 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 57 | this.imageBox2.TabIndex = 6; 58 | this.imageBox2.TabStop = false; 59 | // 60 | // imageBox1 61 | // 62 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 63 | this.imageBox1.Location = new System.Drawing.Point(17, 113); 64 | this.imageBox1.Name = "imageBox1"; 65 | this.imageBox1.Size = new System.Drawing.Size(288, 246); 66 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 67 | this.imageBox1.TabIndex = 5; 68 | this.imageBox1.TabStop = false; 69 | // 70 | // button2 71 | // 72 | this.button2.Location = new System.Drawing.Point(142, 30); 73 | this.button2.Name = "button2"; 74 | this.button2.Size = new System.Drawing.Size(75, 48); 75 | this.button2.TabIndex = 7; 76 | this.button2.Text = "重映射"; 77 | this.button2.UseVisualStyleBackColor = true; 78 | this.button2.Click += new System.EventHandler(this.button2_Click); 79 | // 80 | // FormRemap 81 | // 82 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 | this.ClientSize = new System.Drawing.Size(620, 472); 85 | this.Controls.Add(this.button2); 86 | this.Controls.Add(this.imageBox2); 87 | this.Controls.Add(this.imageBox1); 88 | this.Controls.Add(this.button1); 89 | this.Name = "FormRemap"; 90 | this.Text = "FormRemap"; 91 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 92 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 93 | this.ResumeLayout(false); 94 | 95 | } 96 | 97 | #endregion 98 | 99 | private System.Windows.Forms.Button button1; 100 | private Emgu.CV.UI.ImageBox imageBox2; 101 | private Emgu.CV.UI.ImageBox imageBox1; 102 | private System.Windows.Forms.Button button2; 103 | } 104 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormFloodFill.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormFloodFill 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 35 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 36 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // button1 41 | // 42 | this.button1.Location = new System.Drawing.Point(36, 38); 43 | this.button1.Name = "button1"; 44 | this.button1.Size = new System.Drawing.Size(75, 51); 45 | this.button1.TabIndex = 0; 46 | this.button1.Text = "加载图像"; 47 | this.button1.UseVisualStyleBackColor = true; 48 | this.button1.Click += new System.EventHandler(this.button1_Click); 49 | // 50 | // button2 51 | // 52 | this.button2.Location = new System.Drawing.Point(130, 38); 53 | this.button2.Name = "button2"; 54 | this.button2.Size = new System.Drawing.Size(75, 51); 55 | this.button2.TabIndex = 1; 56 | this.button2.Text = "漫水填充"; 57 | this.button2.UseVisualStyleBackColor = true; 58 | this.button2.Click += new System.EventHandler(this.button2_Click); 59 | // 60 | // imageBox1 61 | // 62 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 63 | this.imageBox1.Location = new System.Drawing.Point(36, 114); 64 | this.imageBox1.Name = "imageBox1"; 65 | this.imageBox1.Size = new System.Drawing.Size(387, 309); 66 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 67 | this.imageBox1.TabIndex = 2; 68 | this.imageBox1.TabStop = false; 69 | // 70 | // imageBox2 71 | // 72 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 73 | this.imageBox2.Location = new System.Drawing.Point(445, 114); 74 | this.imageBox2.Name = "imageBox2"; 75 | this.imageBox2.Size = new System.Drawing.Size(387, 309); 76 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 77 | this.imageBox2.TabIndex = 3; 78 | this.imageBox2.TabStop = false; 79 | // 80 | // FormFloodFill 81 | // 82 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 84 | this.ClientSize = new System.Drawing.Size(894, 590); 85 | this.Controls.Add(this.imageBox2); 86 | this.Controls.Add(this.imageBox1); 87 | this.Controls.Add(this.button2); 88 | this.Controls.Add(this.button1); 89 | this.Name = "FormFloodFill"; 90 | this.Text = "FormFloodFill"; 91 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 92 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 93 | this.ResumeLayout(false); 94 | 95 | } 96 | 97 | #endregion 98 | 99 | private System.Windows.Forms.Button button1; 100 | private System.Windows.Forms.Button button2; 101 | private Emgu.CV.UI.ImageBox imageBox1; 102 | private Emgu.CV.UI.ImageBox imageBox2; 103 | } 104 | } -------------------------------------------------------------------------------- /EmgucvDemo/FormLicensePlate.cs: -------------------------------------------------------------------------------- 1 | using Emgu.CV; 2 | using Emgu.CV.Structure; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Data; 7 | using System.Drawing; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | using System.Windows.Forms; 12 | 13 | namespace OpenCVDemo 14 | { 15 | public partial class FormLicensePlate : Form 16 | { 17 | static string filename; 18 | OpenFileDialog open; 19 | Image src; 20 | 21 | public FormLicensePlate() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private void button1_Click(object sender, EventArgs e) 27 | { 28 | open = new OpenFileDialog(); 29 | if (open.ShowDialog() == DialogResult.OK) 30 | { 31 | filename = open.FileName; 32 | imageBox1.Load(filename); 33 | src = new Image(open.FileName); 34 | } 35 | } 36 | 37 | private void button2_Click(object sender, EventArgs e) 38 | { 39 | FindLicensePlate(); 40 | ReadLicensePlate(); 41 | } 42 | 43 | private void FindLicensePlate() 44 | { 45 | Image simage = src.Copy(); //new Image("license-plate.jpg"); 46 | //Image simage = sizeimage.Resize(400, 300, Emgu.CV.CvEnum.INTER.CV_INTER_NN); 47 | Image GrayImg = new Image(simage.Width, simage.Height); 48 | //IntPtr GrayImg1 = CvInvoke.cvCreateImage(simage.Size, Emgu.CV.CvEnum.IplDepth.IplDepth_8U, 1); 49 | 50 | //灰度化 51 | // CvInvoke.CvtColor(simage.Mat, GrayImg, Emgu.CV.CvEnum.ColorConversion.Bgr2Gray); 52 | //首先创建一张16深度有符号的图像区域 53 | // IntPtr Sobel = CvInvoke.cvCreateImage(simage.Size, Emgu.CV.CvEnum.IplDepth.IplDepth16S, 1); 54 | //X方向的Sobel算子检测 55 | CvInvoke.Sobel(GrayImg, GrayImg, Emgu.CV.CvEnum.DepthType.Cv16S,2, 0, 3); 56 | // IntPtr temp = CvInvoke.cvCreateImage(simage.Size, Emgu.CV.CvEnum.IplDepth.IplDepth_8U, 1); 57 | CvInvoke.cvConvertScale(GrayImg, GrayImg, 0.00390625, 0); 58 | ////int it = ComputeThresholdValue(GrayImg.ToBitmap()); 59 | ////二值化处理 60 | ////Image dest = GrayImg.ThresholdBinary(new Gray(it), new Gray(255)); 61 | Image dest = new Image(simage.Width, simage.Height); 62 | //二值化处理 63 | CvInvoke.Threshold(GrayImg, dest, 0, 255, Emgu.CV.CvEnum.ThresholdType.Otsu); 64 | // IntPtr temp1 = CvInvoke.cvCreateImage(simage.Size, Emgu.CV.CvEnum.IplDepth.IplDepth_8U, 1); 65 | Image dest1 = new Image(simage.Width, simage.Height); 66 | //定义内核 67 | Mat element = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Rectangle, new Size(5, 5), new Point(2, 2)); 68 | 69 | // CvInvoke.CreateStructuringElementEx(3, 1, 1, 0, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_RECT, temp1); 70 | CvInvoke.Dilate(dest, dest1, element, new Point(1,1),1,Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(255, 0, 0, 255)); 71 | CvInvoke.Erode(dest1, dest1, element, new Point(1, 1), 1, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(255, 0, 0, 255)); 72 | CvInvoke.Dilate(dest1, dest1, element, new Point(1, 1), 1, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(255, 0, 0, 255)); 73 | CvInvoke.CreateStructuringElementEx(1, 3, 0, 1, Emgu.CV.CvEnum.CV_ELEMENT_SHAPE.CV_SHAPE_RECT, temp1); 74 | CvInvoke.cvErode(dest1, dest1, temp1, 2); 75 | CvInvoke.cvDilate(dest1, dest1, temp1, 2); 76 | IntPtr dst = CvInvoke.cvCreateImage(simage.Size, Emgu.CV.CvEnum.IplDepth.IplDepth_8U, 3); 77 | CvInvoke.cvZero(dst); 78 | //dest.Dilate(10); 79 | //dest.Erode(5); 80 | using (MemStorage stor = new MemStorage()) 81 | { 82 | CvInvoke.FindContours( dest1, 83 | Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, 84 | Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_CCOMP, 85 | stor); 86 | for (; contours != null; contours = contours.HNext) 87 | { 88 | 89 | Rectangle box = contours.BoundingRectangle; 90 | Image test = simage.CopyBlank(); 91 | test.SetValue(255.0); 92 | double whRatio = (double)box.Width / box.Height; 93 | int area = (int)box.Width * box.Height; 94 | if (area > 1000 && area < 10000) 95 | { 96 | if ((3.0 < whRatio && whRatio < 6.0)) 97 | { 98 | test.Draw(box, new Bgr(Color.Red), 2); 99 | simage.Draw(box, new Bgr(Color.Red), 2);//CvInvoke.cvNamedWindow("dst"); 100 | //CvInvoke.cvShowImage("dst", dst); 101 | imageBox1.Image = simage; 102 | } 103 | } 104 | } 105 | } 106 | 107 | } 108 | 109 | private void ReadLicensePlate() 110 | { 111 | 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormImageSegment.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormImageSegment 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 34 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 35 | this.button2 = new System.Windows.Forms.Button(); 36 | this.toolTip = new System.Windows.Forms.ToolTip(this.components); 37 | this.button3 = new System.Windows.Forms.Button(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // button1 43 | // 44 | this.button1.Location = new System.Drawing.Point(37, 37); 45 | this.button1.Name = "button1"; 46 | this.button1.Size = new System.Drawing.Size(75, 42); 47 | this.button1.TabIndex = 1; 48 | this.button1.Text = "加载图像"; 49 | this.button1.UseVisualStyleBackColor = true; 50 | this.button1.Click += new System.EventHandler(this.button1_Click); 51 | // 52 | // imageBox1 53 | // 54 | this.imageBox1.Location = new System.Drawing.Point(24, 98); 55 | this.imageBox1.Name = "imageBox1"; 56 | this.imageBox1.Size = new System.Drawing.Size(383, 321); 57 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 58 | this.imageBox1.TabIndex = 3; 59 | this.imageBox1.TabStop = false; 60 | // 61 | // imageBox2 62 | // 63 | this.imageBox2.Location = new System.Drawing.Point(424, 98); 64 | this.imageBox2.Name = "imageBox2"; 65 | this.imageBox2.Size = new System.Drawing.Size(383, 321); 66 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 67 | this.imageBox2.TabIndex = 4; 68 | this.imageBox2.TabStop = false; 69 | // 70 | // button2 71 | // 72 | this.button2.Location = new System.Drawing.Point(141, 37); 73 | this.button2.Name = "button2"; 74 | this.button2.Size = new System.Drawing.Size(75, 42); 75 | this.button2.TabIndex = 5; 76 | this.button2.Text = "分水岭"; 77 | this.button2.UseVisualStyleBackColor = true; 78 | this.button2.Click += new System.EventHandler(this.button2_Click); 79 | // 80 | // button3 81 | // 82 | this.button3.Location = new System.Drawing.Point(260, 37); 83 | this.button3.Name = "button3"; 84 | this.button3.Size = new System.Drawing.Size(75, 42); 85 | this.button3.TabIndex = 6; 86 | this.button3.Text = "button3"; 87 | this.button3.UseVisualStyleBackColor = true; 88 | this.button3.Click += new System.EventHandler(this.button3_Click); 89 | // 90 | // FormImageSegment 91 | // 92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 94 | this.ClientSize = new System.Drawing.Size(819, 554); 95 | this.Controls.Add(this.button3); 96 | this.Controls.Add(this.button2); 97 | this.Controls.Add(this.imageBox2); 98 | this.Controls.Add(this.imageBox1); 99 | this.Controls.Add(this.button1); 100 | this.Name = "FormImageSegment"; 101 | this.Text = "FormImageSegment"; 102 | this.Load += new System.EventHandler(this.FormImageSegment_Load); 103 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 104 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 105 | this.ResumeLayout(false); 106 | 107 | } 108 | 109 | #endregion 110 | 111 | private System.Windows.Forms.Button button1; 112 | private Emgu.CV.UI.ImageBox imageBox1; 113 | private Emgu.CV.UI.ImageBox imageBox2; 114 | private System.Windows.Forms.Button button2; 115 | private System.Windows.Forms.ToolTip toolTip; 116 | private System.Windows.Forms.Button button3; 117 | } 118 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBlob.designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormBlob 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.linkLabel1 = new System.Windows.Forms.LinkLabel(); 35 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 36 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // button1 42 | // 43 | this.button1.Location = new System.Drawing.Point(29, 13); 44 | this.button1.Name = "button1"; 45 | this.button1.Size = new System.Drawing.Size(75, 42); 46 | this.button1.TabIndex = 0; 47 | this.button1.Text = "加载图片"; 48 | this.button1.UseVisualStyleBackColor = true; 49 | this.button1.Click += new System.EventHandler(this.button1_Click); 50 | // 51 | // button2 52 | // 53 | this.button2.Location = new System.Drawing.Point(120, 13); 54 | this.button2.Name = "button2"; 55 | this.button2.Size = new System.Drawing.Size(75, 42); 56 | this.button2.TabIndex = 2; 57 | this.button2.Text = "斑点检测"; 58 | this.button2.UseVisualStyleBackColor = true; 59 | this.button2.Click += new System.EventHandler(this.button2_Click); 60 | // 61 | // linkLabel1 62 | // 63 | this.linkLabel1.AutoSize = true; 64 | this.linkLabel1.Location = new System.Drawing.Point(433, 28); 65 | this.linkLabel1.Name = "linkLabel1"; 66 | this.linkLabel1.Size = new System.Drawing.Size(317, 12); 67 | this.linkLabel1.TabIndex = 4; 68 | this.linkLabel1.TabStop = true; 69 | this.linkLabel1.Text = "http://blog.csdn.net/zhaocj/article/details/44886475"; 70 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 71 | // 72 | // imageBox1 73 | // 74 | this.imageBox1.Location = new System.Drawing.Point(29, 97); 75 | this.imageBox1.Name = "imageBox1"; 76 | this.imageBox1.Size = new System.Drawing.Size(426, 304); 77 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 78 | this.imageBox1.TabIndex = 2; 79 | this.imageBox1.TabStop = false; 80 | // 81 | // imageBox2 82 | // 83 | this.imageBox2.Location = new System.Drawing.Point(474, 97); 84 | this.imageBox2.Name = "imageBox2"; 85 | this.imageBox2.Size = new System.Drawing.Size(426, 304); 86 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 87 | this.imageBox2.TabIndex = 5; 88 | this.imageBox2.TabStop = false; 89 | // 90 | // FormBlob 91 | // 92 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 93 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 94 | this.ClientSize = new System.Drawing.Size(912, 450); 95 | this.Controls.Add(this.imageBox2); 96 | this.Controls.Add(this.imageBox1); 97 | this.Controls.Add(this.linkLabel1); 98 | this.Controls.Add(this.button2); 99 | this.Controls.Add(this.button1); 100 | this.Name = "FormBlob"; 101 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 102 | this.Text = "斑点"; 103 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 104 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 105 | this.ResumeLayout(false); 106 | this.PerformLayout(); 107 | 108 | } 109 | 110 | #endregion 111 | 112 | private System.Windows.Forms.Button button1; 113 | private System.Windows.Forms.Button button2; 114 | private System.Windows.Forms.LinkLabel linkLabel1; 115 | private Emgu.CV.UI.ImageBox imageBox1; 116 | private Emgu.CV.UI.ImageBox imageBox2; 117 | } 118 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormTemplateMatch.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormTemplateMatch 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.button3 = new System.Windows.Forms.Button(); 35 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 36 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // button1 42 | // 43 | this.button1.Location = new System.Drawing.Point(41, 28); 44 | this.button1.Name = "button1"; 45 | this.button1.Size = new System.Drawing.Size(75, 43); 46 | this.button1.TabIndex = 0; 47 | this.button1.Text = "加载图像"; 48 | this.button1.UseVisualStyleBackColor = true; 49 | this.button1.Click += new System.EventHandler(this.button1_Click); 50 | // 51 | // button2 52 | // 53 | this.button2.Location = new System.Drawing.Point(140, 28); 54 | this.button2.Name = "button2"; 55 | this.button2.Size = new System.Drawing.Size(75, 43); 56 | this.button2.TabIndex = 1; 57 | this.button2.Text = "加载模板"; 58 | this.button2.UseVisualStyleBackColor = true; 59 | this.button2.Click += new System.EventHandler(this.button2_Click); 60 | // 61 | // button3 62 | // 63 | this.button3.Location = new System.Drawing.Point(234, 28); 64 | this.button3.Name = "button3"; 65 | this.button3.Size = new System.Drawing.Size(75, 43); 66 | this.button3.TabIndex = 2; 67 | this.button3.Text = "开始匹配"; 68 | this.button3.UseVisualStyleBackColor = true; 69 | this.button3.Click += new System.EventHandler(this.button3_Click); 70 | // 71 | // imageBox1 72 | // 73 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 74 | this.imageBox1.Location = new System.Drawing.Point(14, 106); 75 | this.imageBox1.Name = "imageBox1"; 76 | this.imageBox1.Size = new System.Drawing.Size(330, 295); 77 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 78 | this.imageBox1.TabIndex = 2; 79 | this.imageBox1.TabStop = false; 80 | // 81 | // imageBox2 82 | // 83 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 84 | this.imageBox2.Location = new System.Drawing.Point(363, 106); 85 | this.imageBox2.Name = "imageBox2"; 86 | this.imageBox2.Size = new System.Drawing.Size(330, 295); 87 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 88 | this.imageBox2.TabIndex = 3; 89 | this.imageBox2.TabStop = false; 90 | // 91 | // FormTemplateMatch 92 | // 93 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 94 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 95 | this.ClientSize = new System.Drawing.Size(705, 529); 96 | this.Controls.Add(this.imageBox2); 97 | this.Controls.Add(this.imageBox1); 98 | this.Controls.Add(this.button3); 99 | this.Controls.Add(this.button2); 100 | this.Controls.Add(this.button1); 101 | this.Name = "FormTemplateMatch"; 102 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 103 | this.Text = "FormTemplateMatch"; 104 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 105 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 106 | this.ResumeLayout(false); 107 | 108 | } 109 | 110 | #endregion 111 | 112 | private System.Windows.Forms.Button button1; 113 | private System.Windows.Forms.Button button2; 114 | private System.Windows.Forms.Button button3; 115 | private Emgu.CV.UI.ImageBox imageBox1; 116 | private Emgu.CV.UI.ImageBox imageBox2; 117 | } 118 | } -------------------------------------------------------------------------------- /EmgucvDemo/LicensePlateRecognition/FormLicensePlate.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormLicensePlate 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 33 | this.button1 = new System.Windows.Forms.Button(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); 36 | this.processTimeLabel = new System.Windows.Forms.Label(); 37 | this.panel1 = new System.Windows.Forms.Panel(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // imageBox1 42 | // 43 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 44 | this.imageBox1.Location = new System.Drawing.Point(25, 108); 45 | this.imageBox1.Name = "imageBox1"; 46 | this.imageBox1.Size = new System.Drawing.Size(363, 304); 47 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; 48 | this.imageBox1.TabIndex = 2; 49 | this.imageBox1.TabStop = false; 50 | // 51 | // button1 52 | // 53 | this.button1.Location = new System.Drawing.Point(68, 40); 54 | this.button1.Name = "button1"; 55 | this.button1.Size = new System.Drawing.Size(75, 34); 56 | this.button1.TabIndex = 3; 57 | this.button1.Text = "加载图片"; 58 | this.button1.UseVisualStyleBackColor = true; 59 | this.button1.Click += new System.EventHandler(this.button1_Click); 60 | // 61 | // button2 62 | // 63 | this.button2.Location = new System.Drawing.Point(170, 40); 64 | this.button2.Name = "button2"; 65 | this.button2.Size = new System.Drawing.Size(75, 34); 66 | this.button2.TabIndex = 4; 67 | this.button2.Text = "车牌识别"; 68 | this.button2.UseVisualStyleBackColor = true; 69 | this.button2.Click += new System.EventHandler(this.button2_Click); 70 | // 71 | // openFileDialog1 72 | // 73 | this.openFileDialog1.FileName = "openFileDialog1"; 74 | // 75 | // processTimeLabel 76 | // 77 | this.processTimeLabel.AutoSize = true; 78 | this.processTimeLabel.Font = new System.Drawing.Font("宋体", 10F); 79 | this.processTimeLabel.Location = new System.Drawing.Point(348, 18); 80 | this.processTimeLabel.Name = "processTimeLabel"; 81 | this.processTimeLabel.Size = new System.Drawing.Size(49, 14); 82 | this.processTimeLabel.TabIndex = 6; 83 | this.processTimeLabel.Text = "label1"; 84 | // 85 | // panel1 86 | // 87 | this.panel1.Location = new System.Drawing.Point(401, 108); 88 | this.panel1.Name = "panel1"; 89 | this.panel1.Size = new System.Drawing.Size(272, 100); 90 | this.panel1.TabIndex = 7; 91 | // 92 | // FormLicensePlate 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.ClientSize = new System.Drawing.Size(757, 459); 97 | this.Controls.Add(this.panel1); 98 | this.Controls.Add(this.processTimeLabel); 99 | this.Controls.Add(this.button2); 100 | this.Controls.Add(this.button1); 101 | this.Controls.Add(this.imageBox1); 102 | this.Name = "FormLicensePlate"; 103 | this.Text = "Form1"; 104 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormLicensePlate_FormClosing); 105 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 106 | this.ResumeLayout(false); 107 | this.PerformLayout(); 108 | 109 | } 110 | 111 | #endregion 112 | 113 | private Emgu.CV.UI.ImageBox imageBox1; 114 | private System.Windows.Forms.Button button1; 115 | private System.Windows.Forms.Button button2; 116 | private System.Windows.Forms.OpenFileDialog openFileDialog1; 117 | private System.Windows.Forms.Label processTimeLabel; 118 | private System.Windows.Forms.Panel panel1; 119 | } 120 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormHough.cs: -------------------------------------------------------------------------------- 1 | using Emgu.CV; 2 | using Emgu.CV.CvEnum; 3 | using Emgu.CV.Structure; 4 | using Emgu.CV.Util; 5 | using System; 6 | using System.Drawing; 7 | using System.Windows.Forms; 8 | 9 | namespace EmgucvDemo 10 | { 11 | public partial class FormHough : Form 12 | { 13 | static string filename; 14 | OpenFileDialog open; 15 | Image src; 16 | Image src2; 17 | 18 | public FormHough() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | private void button1_Click(object sender, EventArgs e) 24 | { 25 | open = new OpenFileDialog(); 26 | if (open.ShowDialog() == DialogResult.OK) 27 | { 28 | filename = open.FileName; 29 | pictureBox1.Load(filename); 30 | src = new Image(open.FileName); 31 | } 32 | } 33 | 34 | private void btn_FindCycle_Click(object sender, EventArgs e) 35 | { 36 | if (src == null) 37 | return; 38 | textBox1.Text = null; 39 | double dp = Convert.ToDouble(numericUpDown1.Value); ; 40 | double minDist = Convert.ToDouble(numericUpDown2.Value); 41 | double cannyThreshold = Convert.ToDouble(numericUpDown3.Value); 42 | double circleAccumulatorThreshold = Convert.ToDouble(numericUpDown4.Value); 43 | int minRadius = Convert.ToInt32(numericUpDown5.Value); 44 | int maxRadius = Convert.ToInt32(numericUpDown6.Value); 45 | 46 | Image image_gray = src.Convert(); 47 | CircleF[] circles = CvInvoke.HoughCircles(image_gray, HoughType.Gradient, dp, minDist, cannyThreshold, circleAccumulatorThreshold, minRadius, maxRadius); 48 | 49 | foreach (CircleF circle in circles) 50 | { 51 | CvInvoke.Circle(image_gray, Point.Round(circle.Center), (int)circle.Radius, new Bgr(Color.Red).MCvScalar, 3); 52 | pictureBox1.Image = image_gray.Bitmap; 53 | pictureBox1.Refresh(); 54 | } 55 | textBox1.Text = "共检测到" + circles.Length + "个圆!" + "\r\n"; 56 | for (int i = 0; i < circles.Length; i++) 57 | { 58 | textBox1.Text += "第"+i+"个圆的圆心坐标:("+circles[i].Center.X +","+ circles[i].Center.Y+")"+"半径:"+ circles[i].Radius+"\r\n"; 59 | } 60 | } 61 | 62 | 63 | 64 | private void button2_Click(object sender, EventArgs e) 65 | { 66 | textBox1.Text = ""; 67 | double Thershold1 = Convert.ToDouble(numericUpDown8.Value); 68 | double Thershold2 = Convert.ToDouble(numericUpDown9.Value); 69 | Image imagedst=new Image(src.Size); 70 | 71 | //CvInvoke.Threshold(imagesrc, imagedst, Thershold1, 255, ThresholdType.Binary); 72 | CvInvoke.Canny(src, imagedst, Thershold1, Thershold2); 73 | //CvInvoke.CvtColor(imagedst, imagedst, ColorConversion.BayerBg2Gray);//灰度化 74 | pictureBox2.Image = imagedst.Bitmap; 75 | VectorOfInt vp = new VectorOfInt(); 76 | double rho = Convert.ToDouble(numericUpDown7.Value); 77 | int HoughLinesThershold = Convert.ToInt32(numericUpDown12.Value);//大于此阈值的交点,才会被认为是一条直线 78 | double minLineLenth = Convert.ToDouble(numericUpDown11.Value); 79 | double maxGrap = Convert.ToDouble(numericUpDown10.Value); 80 | try 81 | { 82 | // CvInvoke.HoughLines(imagedst, vp, rho, theta, HoughLinesThershold, minLineLenth, maxGrap); 83 | // LineSegment2D[][] _lines = imagedst.HoughLines(100,100, rho, theta,HoughLinesThershold,minLineLenth,maxGrap); 84 | //for(int i=0;i<_lines[0].Length;i++) 85 | //{ 86 | // //for(int j = 0; j < _lines[0].Length; j++) 87 | // CvInvoke.Line(src, _lines[0][i].P1, _lines[0][i].P2, new Bgr(0, 0, 255).MCvScalar, 2);//在原图像中画线 88 | //} 89 | 90 | LineSegment2D[] lines = CvInvoke.HoughLinesP(imagedst,//8位单通道图像 91 | rho, //距离分辨率 92 | Math.PI / 180, //角度分辨率 93 | HoughLinesThershold,//交点个数阈值 94 | minLineLenth,//最小直线长度 95 | maxGrap//最大直线间隙,间隙大于该值,则被认为是两条线段,否则是一条 96 | ); 97 | textBox1.Text = "总共找到" + lines.Length + "根直线。" + "\r\n"; 98 | src2 = src.Copy(); 99 | for (int i = 0; i < lines.Length; ++i) 100 | { 101 | CvInvoke.Line(src2, lines[i].P1, lines[i].P2, new Bgr(0, 0, 255).MCvScalar, 3);//在原图像中画线 102 | double angle = Math.Atan2(lines[i].P1.Y - lines[i].P2.Y, lines[i].P1.X - lines[i].P2.X); 103 | textBox1.Text += ("第" + i + "根直线的角度:" + angle + "\r\n").ToString(); 104 | } 105 | 106 | } 107 | catch 108 | { 109 | throw; 110 | } 111 | pictureBox1.Image = src2.Bitmap; 112 | } 113 | 114 | private void FormHough_Load(object sender, EventArgs e) 115 | { 116 | 117 | } 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCircle.cs: -------------------------------------------------------------------------------- 1 | using Emgu.CV; 2 | using Emgu.CV.Structure; 3 | using Emgu.CV.Util; 4 | using System; 5 | using System.Drawing; 6 | using System.Windows.Forms; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormCircle : Form 11 | { 12 | Image src; 13 | Image gray_scr; 14 | static string filename; 15 | OpenFileDialog open; 16 | 17 | public FormCircle() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | open = new OpenFileDialog(); 25 | if (open.ShowDialog() == DialogResult.OK) 26 | { 27 | filename = open.FileName; 28 | imageBox1.Load(filename); 29 | src = new Image(open.FileName); 30 | } 31 | } 32 | private void button2_Click(object sender, EventArgs e) 33 | { 34 | gray_scr = src.Convert(); 35 | //进行中值滤波去噪 36 | gray_scr = gray_scr.SmoothMedian(5); 37 | 38 | // CvInvoke.EqualizeHist(gray_scr, gray_scr); //直方图均衡化 39 | imageBox2.Image = gray_scr; 40 | CvInvoke.Threshold(gray_scr, gray_scr, Convert.ToInt32(numericUpDown1.Value), 255, Emgu.CV.CvEnum.ThresholdType.Binary); 41 | imageBox3.Image = gray_scr; 42 | //获取内核,用于形态学操作 43 | Mat kennel = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Cross, new Size(3, 3), new Point(-1, -1)); 44 | ////对图像进行形态闭学开操作 45 | CvInvoke.MorphologyEx(gray_scr, gray_scr, Emgu.CV.CvEnum.MorphOp.Close, kennel, new Point(-1, -1), 3, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(0, 0, 0)); 46 | ////腐蚀 47 | CvInvoke.MorphologyEx(gray_scr, gray_scr, Emgu.CV.CvEnum.MorphOp.Erode, kennel, new Point(-1, -1), 2, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(0, 0, 0)); 48 | //形态学闭操作 49 | CvInvoke.MorphologyEx(gray_scr, gray_scr, Emgu.CV.CvEnum.MorphOp.Close, kennel, new Point(-1, -1), 3, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar(0, 0, 0)); 50 | imageBox4.Image = gray_scr; 51 | 52 | // gray_scr = gray_scr.SmoothMedian(3); 53 | gray_scr = gray_scr.ThresholdAdaptive(new Gray(255), Emgu.CV.CvEnum.AdaptiveThresholdType.GaussianC, Emgu.CV.CvEnum.ThresholdType.Binary, 45, new Gray(-1)); 54 | // gray_scr = gray_scr.Dilate(1); 55 | 56 | //canny轮廓检测 57 | gray_scr = gray_scr.Canny(Convert.ToInt32(numericUpDown2.Value), Convert.ToInt32(numericUpDown2.Value) + Convert.ToInt32(numericUpDown2.Value / 2)); 58 | imageBox5.Image = gray_scr; 59 | //膨胀(避免轮廓的不连续【重点】 60 | gray_scr = gray_scr.Dilate(1); 61 | imageBox5.Image = gray_scr; 62 | } 63 | 64 | private void button3_Click(object sender, EventArgs e) 65 | { 66 | textBox1.Text = ""; 67 | CircleF circle=new CircleF(); 68 | VectorOfVectorOfPoint vvp = new VectorOfVectorOfPoint();//存储所有的轮廓 69 | VectorOfVectorOfPoint cricle_vvp = new VectorOfVectorOfPoint();//存储筛选过后圆的轮廓. 70 | 71 | CvInvoke.FindContours(gray_scr, vvp, null, Emgu.CV.CvEnum.RetrType.List, Emgu.CV.CvEnum.ChainApproxMethod.ChainApproxNone); 72 | 73 | for (int i = 0; i < vvp.Size; i++)//遍历所有轮廓 74 | { 75 | double area = CvInvoke.ContourArea(vvp[i]);//假设如果轮廓为圆,即面积为:PI*R^2 76 | double length = CvInvoke.ArcLength(vvp[i], true);//假设如果轮廓为圆,即周长为:PI*R*2 77 | double r = (area / length) * 2;//假设如果轮廓为圆: 面积/周长=R/2;即半径为: 面积*2/周长 78 | double c = (area / (length * length));//假设轮廓为圆: 面积/(周长的平方)=1/(4*PI)常数; 0.0796 79 | if (c > 0.063 && c < 0.08)//满足相应条件 80 | { 81 | if (r < Convert.ToInt32(numericUpDown4.Value) && r > Convert.ToInt32(numericUpDown3.Value)) 82 | { 83 | cricle_vvp.Push(vvp[i]);//提取筛选后的圆轮廓 84 | circle = CvInvoke.MinEnclosingCircle(vvp[i]); 85 | textBox1.Text += "找到第" + i + "个圆,比例值:" + c + "半径为:" + r + "\r\n"+ "圆心为:" + circle.Center.X+","+ circle.Center.Y+","+ "半径为:" + circle.Radius + "\r\n"; 86 | } 87 | } 88 | } 89 | 90 | Mat result = new Mat(gray_scr.Size, Emgu.CV.CvEnum.DepthType.Cv8U, 3); 91 | result.SetTo(new MCvScalar(0, 0, 0)); 92 | CvInvoke.DrawContours(result, vvp, -1, new MCvScalar(0, 255, 0)); 93 | imageBox6.Image = result; 94 | 95 | if (cricle_vvp.Size == 0) 96 | { 97 | textBox1.Text = "没有找到合适的圆!"; 98 | } 99 | else 100 | { 101 | for (int i = 0; i < cricle_vvp.Size; i++) 102 | { 103 | //Rectangle rect = CvInvoke.BoundingRectangle(cricle_vvp[i]); 104 | //src.Draw(rect, new Bgr(0, 0, 255), 2); 105 | CvInvoke.Circle(src,new Point((int)circle.Center.X,(int) circle.Center.Y), (int)circle.Radius,new Bgr(0,0,255).MCvScalar,3); 106 | 107 | CvInvoke.Circle(src,new Point((int)circle.Center.X,(int) circle.Center.Y), 3,new Bgr(0,0,255).MCvScalar,3); 108 | } 109 | imageBox1.Image = src; 110 | imageBox1.Refresh(); 111 | } 112 | } 113 | } 114 | } 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormFilter.cs: -------------------------------------------------------------------------------- 1 | using Emgu.CV; 2 | using Emgu.CV.Structure; 3 | using System; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | namespace EmgucvDemo 8 | { 9 | public partial class FormFilter : Form 10 | { 11 | static string filename; 12 | OpenFileDialog open; 13 | Image src; 14 | 15 | int g_nBoxFilterValue = 5; //方框滤波内核值 16 | int g_nBlurValue = 5; //均值滤波内核值 17 | int g_nGaussianBlurValue = 5; //高斯滤波内核值 18 | int g_nMedianBlurValue = 5; //中值滤波参数值 19 | int g_nBilateralFilterValue = 10; //双边滤波参数值 20 | 21 | public FormFilter() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private void button1_Click(object sender, EventArgs e) 27 | { 28 | open = new OpenFileDialog(); 29 | if (open.ShowDialog() == DialogResult.OK) 30 | { 31 | filename = open.FileName; 32 | imageBox1.Load(filename); 33 | src = new Image(open.FileName); 34 | } 35 | } 36 | 37 | private void button2_Click(object sender, EventArgs e) 38 | { 39 | Image dst = src.CopyBlank(); 40 | CvInvoke.BoxFilter(src,dst,Emgu.CV.CvEnum.DepthType.Default,new Size(g_nBoxFilterValue, g_nBoxFilterValue),new Point(-1,-1)); 41 | //第一个参数,InputArray类型的src,输入图像,即源图像。 42 | //第二个参数,OutputArray类型的dst,即目标图像,需要和源图片有一样的尺寸和类型。 43 | //第三个参数,int类型的ddepth,输出图像的深度,-1代表使用原图深度,即src.depth()。 44 | //第四个参数,Size类型的ksize,内核的大小。一般这样写Size(w, h)来表示内核的大小(其中,w 为像素宽度, h为像素高度)。Size(3,3)就表示3x3的核大小,Size(5,5)就表示5x5的核大小,也就是滤波器模板的大小。 45 | //第五个参数,Point类型的anchor,表示锚点(即被平滑的那个点),默认值为Point(-1, -1)。如果这个点坐标是负值的话,就表示取核的中心为锚点,所以默认值Point(-1, -1)表示这个锚点在核的中心。 46 | //第六个参数,bool类型的normalize,默认值为true,一个标识符,表示内核是否被其区域归一化(normalized)了。 47 | //第七个参数,int类型的borderType,用于推断图像外部像素的某种边界模式。有默认值BORDER_DEFAULT,我们一般不去管它。 48 | imageBox2.Image = dst; 49 | 50 | } 51 | 52 | private void button3_Click(object sender, EventArgs e) 53 | { 54 | Image dst = src.CopyBlank(); 55 | CvInvoke.Blur(src, dst, new Size(g_nBlurValue, g_nBlurValue), new Point(-1, -1)); 56 | //第一个参数,InputArray类型的src,输入图像,即源图像,填Mat类的对象即可。该函数对通道是独立处理的,且可以处理任意通道数的图片,但需要注意,待处理的图片深度应该为CV_8U, CV_16U, CV_16S, CV_32F 以及 CV_64F之一。 57 | //第二个参数,OutputArray类型的dst,即目标图像,需要和源图片有一样的尺寸和类型。比如可以用Mat::Clone,以源图片为模板,来初始化得到如假包换的目标图。 58 | //第三个参数,Size类型的ksize内核的大小。一般这样写Size(w, h)来表示内核的大小(其中,w 为像素宽度, h为像素高度)。Size(3,3)就表示3x3的核大小,Size(5,5)就表示5x5的核大小 59 | //第四个参数,Point类型的anchor,表示锚点(即被平滑的那个点),注意他有默认值Point(-1, -1)。如果这个点坐标是负值的话,就表示取核的中心为锚点,所以默认值Point(-1, -1)表示这个锚点在核的中心。 60 | //第五个参数,int类型的borderType,用于推断图像外部像素的某种边界模式。有默认值BORDER_DEFAULT,我们一般不去管它。 61 | imageBox2.Image = dst; 62 | 63 | } 64 | 65 | private void button4_Click(object sender, EventArgs e) 66 | { 67 | Image dst = src.CopyBlank(); 68 | CvInvoke.GaussianBlur(src, dst, new Size(g_nGaussianBlurValue, g_nGaussianBlurValue), 0, 0); 69 | //第一个参数,InputArray类型的src,输入图像,即源图像,填Mat类的对象即可。它可以是单独的任意通道数的图片,但需要注意,图片深度应该为CV_8U,CV_16U, CV_16S, CV_32F 以及 CV_64F之一。 70 | //第二个参数,OutputArray类型的dst,即目标图像,需要和源图片有一样的尺寸和类型。比如可以用Mat::Clone,以源图片为模板,来初始化得到如假包换的目标图。 71 | //第三个参数,Size类型的ksize高斯内核的大小。其中ksize.width和ksize.height可以不同,但他们都必须为正数和奇数。或者,它们可以是零的,它们都是由sigma计算而来。 72 | //第四个参数,double类型的sigmaX,表示高斯核函数在X方向的的标准偏差。 73 | //第五个参数,double类型的sigmaY,表示高斯核函数在Y方向的的标准偏差。若sigmaY为零,就将它设为sigmaX,如果sigmaX和sigmaY都是0,那么就由ksize.width和ksize.height计算出来。 74 | //为了结果的正确性着想,最好是把第三个参数Size,第四个参数sigmaX和第五个参数sigmaY全部指定到。 75 | //第六个参数,int类型的borderType,用于推断图像外部像素的某种边界模式。有默认值BORDER_DEFAULT,我们一般不去管它。 76 | imageBox2.Image = dst; 77 | 78 | } 79 | 80 | private void button5_Click(object sender, EventArgs e) 81 | { 82 | Image dst = src.CopyBlank(); 83 | CvInvoke.MedianBlur(src, dst, g_nMedianBlurValue); 84 | //第一个参数,InputArray类型的src,函数的输入参数,填1、3或者4通道的Mat类型的图像;当ksize为3或者5的时候,图像深度需为CV_8U,CV_16U,或CV_32F其中之一,而对于较大孔径尺寸的图片,它只能是CV_8U。 85 | //第二个参数,OutputArray类型的dst,即目标图像,函数的输出参数,需要和源图片有一样的尺寸和类型。我们可以用Mat::Clone,以源图片为模板,来初始化得到如假包换的目标图。 86 | //第三个参数,int类型的ksize,孔径的线性尺寸(aperture linear size),注意这个参数必须是大于1的奇数,比如:3,5,7,9... 87 | imageBox2.Image = dst; 88 | 89 | } 90 | 91 | private void button6_Click(object sender, EventArgs e) 92 | { 93 | Image dst = src.CopyBlank(); 94 | CvInvoke.BilateralFilter(src, dst, g_nBilateralFilterValue, g_nBilateralFilterValue * 2, g_nBilateralFilterValue / 2); 95 | //第一个参数,InputArray类型的src,输入图像,即源图像,需要为8位或者浮点型单通道、三通道的图像。 96 | //第二个参数,OutputArray类型的dst,即目标图像,需要和源图片有一样的尺寸和类型。 97 | //第三个参数,int类型的d,表示在过滤过程中每个像素邻域的直径。如果这个值我们设其为非正数,那么OpenCV会从第五个参数sigmaSpace来计算出它来。 98 | //第四个参数,double类型的sigmaColor,颜色空间滤波器的sigma值。这个参数的值越大,就表明该像素邻域内有更宽广的颜色会被混合到一起,产生较大的半相等颜色区域。 99 | //第五个参数,double类型的sigmaSpace坐标空间中滤波器的sigma值,坐标空间的标注方差。他的数值越大,意味着越远的像素会相互影响,从而使更大的区域足够相似的颜色获取相同的颜色。当d > 0,d指定了邻域大小且与sigmaSpace无关。否则,d正比于sigmaSpace。 100 | //第六个参数,int类型的borderType,用于推断图像外部像素的某种边界模式。注意它有默认值BORDER_DEFAULT。 101 | imageBox2.Image = dst; 102 | 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormDFT.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormDFT 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 36 | this.imageBox3 = new Emgu.CV.UI.ImageBox(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // button1 43 | // 44 | this.button1.Location = new System.Drawing.Point(33, 12); 45 | this.button1.Name = "button1"; 46 | this.button1.Size = new System.Drawing.Size(75, 42); 47 | this.button1.TabIndex = 0; 48 | this.button1.Text = "加载图像"; 49 | this.button1.UseVisualStyleBackColor = true; 50 | this.button1.Click += new System.EventHandler(this.button1_Click); 51 | // 52 | // imageBox1 53 | // 54 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 55 | this.imageBox1.Location = new System.Drawing.Point(33, 92); 56 | this.imageBox1.Name = "imageBox1"; 57 | this.imageBox1.Size = new System.Drawing.Size(288, 246); 58 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 59 | this.imageBox1.TabIndex = 2; 60 | this.imageBox1.TabStop = false; 61 | // 62 | // button2 63 | // 64 | this.button2.Location = new System.Drawing.Point(137, 12); 65 | this.button2.Name = "button2"; 66 | this.button2.Size = new System.Drawing.Size(75, 42); 67 | this.button2.TabIndex = 3; 68 | this.button2.Text = "傅里叶变换"; 69 | this.button2.UseVisualStyleBackColor = true; 70 | this.button2.Click += new System.EventHandler(this.button2_Click); 71 | // 72 | // imageBox2 73 | // 74 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 75 | this.imageBox2.Location = new System.Drawing.Point(327, 92); 76 | this.imageBox2.Name = "imageBox2"; 77 | this.imageBox2.Size = new System.Drawing.Size(293, 246); 78 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 79 | this.imageBox2.TabIndex = 4; 80 | this.imageBox2.TabStop = false; 81 | // 82 | // imageBox3 83 | // 84 | this.imageBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 85 | this.imageBox3.Location = new System.Drawing.Point(626, 92); 86 | this.imageBox3.Name = "imageBox3"; 87 | this.imageBox3.Size = new System.Drawing.Size(293, 246); 88 | this.imageBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 89 | this.imageBox3.TabIndex = 5; 90 | this.imageBox3.TabStop = false; 91 | // 92 | // FormDFT 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.ClientSize = new System.Drawing.Size(938, 518); 97 | this.Controls.Add(this.imageBox3); 98 | this.Controls.Add(this.imageBox2); 99 | this.Controls.Add(this.button2); 100 | this.Controls.Add(this.imageBox1); 101 | this.Controls.Add(this.button1); 102 | this.Name = "FormDFT"; 103 | this.Text = "FormDFT"; 104 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 105 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 106 | ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).EndInit(); 107 | this.ResumeLayout(false); 108 | 109 | } 110 | 111 | #endregion 112 | 113 | private System.Windows.Forms.Button button1; 114 | private Emgu.CV.UI.ImageBox imageBox1; 115 | private System.Windows.Forms.Button button2; 116 | private Emgu.CV.UI.ImageBox imageBox2; 117 | private Emgu.CV.UI.ImageBox imageBox3; 118 | } 119 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormEdge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using Emgu.CV; 5 | using Emgu.CV.Structure; 6 | using Emgu.CV.CvEnum; 7 | 8 | namespace EmgucvDemo 9 | { 10 | public partial class FormEdge : Form 11 | { 12 | static string filename; 13 | OpenFileDialog open; 14 | Image src; 15 | 16 | 17 | public FormEdge() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | open = new OpenFileDialog(); 25 | if (open.ShowDialog() == DialogResult.OK) 26 | { 27 | filename = open.FileName; 28 | imageBox1.Load(filename); 29 | src = new Image(open.FileName); 30 | 31 | } 32 | } 33 | 34 | private void button2_Click(object sender, EventArgs e) 35 | { 36 | 37 | double Thershold1 = Convert.ToDouble(numericUpDown1.Value); 38 | double Thershold2 = Convert.ToDouble(numericUpDown2.Value); 39 | Image dst_gray = src.Convert() ; 40 | // 先使用 3x3内核来降噪 41 | CvInvoke.Blur(dst_gray, dst_gray, new Size(3, 3),new Point(1,1)); 42 | CvInvoke.Canny(dst_gray, dst_gray, Thershold1, Thershold2); 43 | //第一个参数,InputArray类型的image,输入图像,即源图像,填Mat类的对象即可,且需为单通道8位图像。 44 | //第二个参数,OutputArray类型的edges,输出的边缘图,需要和源图片有一样的尺寸和类型。 45 | //第三个参数,double类型的threshold1,第一个滞后性阈值。 46 | //第四个参数,double类型的threshold2,第二个滞后性阈值。 47 | //第五个参数,int类型的apertureSize,表示应用Sobel算子的孔径大小,其有默认值3。 48 | //第六个参数,bool类型的L2gradient,一个计算图像梯度幅值的标识,有默认值false。 49 | 50 | imageBox2.Image = dst_gray; 51 | } 52 | 53 | /// 54 | /// Sobel边缘检测 55 | /// 56 | /// 57 | /// 58 | private void button3_Click(object sender, EventArgs e) 59 | { 60 | Image srcimage = src.Copy(); 61 | //【1】创建 grad_x 和 grad_y 矩阵 62 | Mat grad_x = new Mat(); 63 | Mat grad_y=new Mat(); 64 | Mat abs_grad_x = new Mat(); 65 | Mat abs_grad_y = new Mat(); 66 | Mat dst = new Mat(); 67 | //【2】求 X方向梯度 68 | CvInvoke.Sobel(srcimage, grad_x,DepthType.Default, 1, 0); 69 | CvInvoke.ConvertScaleAbs(grad_x, abs_grad_x,1,0); 70 | imageBox2.Image = abs_grad_x; 71 | 72 | //【3】求Y方向梯度 73 | CvInvoke.Sobel(srcimage, grad_y, DepthType.Default, 0, 1); 74 | CvInvoke.ConvertScaleAbs(grad_y, abs_grad_y, 1, 0); 75 | imageBox3.Image = abs_grad_y; 76 | 77 | //【4】合并梯度(近似) 78 | CvInvoke.AddWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, dst); 79 | imageBox4.Image = dst; 80 | } 81 | 82 | //拉普拉斯锐化 83 | private void button4_Click(object sender, EventArgs e) 84 | { 85 | Image srcimage = src.Copy(); 86 | //【0】变量的定义 87 | Mat src_gray = new Mat(); 88 | Mat dst = new Mat(); 89 | Mat abs_dst = new Mat() ; 90 | 91 | //【1】使用高斯滤波消除噪声 92 | CvInvoke.GaussianBlur(srcimage, srcimage, new Size(3, 3), 0, 0); 93 | imageBox2.Image = srcimage; 94 | //【2】转换为灰度图 95 | CvInvoke.CvtColor(srcimage, src_gray,ColorConversion.Bgr2Gray); 96 | imageBox3.Image = src_gray; 97 | //【3】使用Laplace函数 98 | CvInvoke.Laplacian(src_gray, dst,DepthType.Cv16S, 3, 1, 0); 99 | //第一个参数,InputArray类型的image,输入图像,即源图像,填Mat类的对象即可,且需为单通道8位图像。 100 | //第二个参数,OutputArray类型的edges,输出的边缘图,需要和源图片有一样的尺寸和通道数。 101 | //第三个参数,int类型的ddept,目标图像的深度。 102 | //第四个参数,int类型的ksize,用于计算二阶导数的滤波器的孔径尺寸,大小必须为正奇数,且有默认值1。 103 | //第五个参数,double类型的scale,计算拉普拉斯值的时候可选的比例因子,有默认值1。 104 | //第六个参数,double类型的delta,表示在结果存入目标图(第二个参数dst)之前可选的delta值,有默认值0。 105 | //第七个参数, int类型的borderType,边界模式,默认值为BORDER_DEFAULT。这个参数可以在官方文档中borderInterpolate()处得到更详细的信息。 106 | //【4】计算绝对值,并将结果转换成8位 107 | CvInvoke.ConvertScaleAbs(dst, abs_dst,1,0); 108 | imageBox4.Image = abs_dst; 109 | } 110 | 111 | private void button5_Click(object sender, EventArgs e) 112 | { 113 | //EMGUCV 中未找到Scharr 114 | ////使用Scharr滤波器运算符计算x或y方向的图像差分。其实它的参数变量和Sobel基本上是一样的,除了没有ksize核的大小 115 | //Image srcimage = src.Copy(); 116 | ////【1】创建 grad_x 和 grad_y 矩阵 117 | //Mat grad_x = new Mat(); 118 | //Mat grad_y = new Mat(); 119 | //Mat abs_grad_x = new Mat(); 120 | //Mat abs_grad_y = new Mat(); 121 | //Mat dst = new Mat(); 122 | ////【2】求 X方向梯度 123 | ////Scharr(srcimage, grad_x, DepthType.Default, 1, 0); 124 | //CvInvoke.ConvertScaleAbs(grad_x, abs_grad_x, 1, 1); 125 | //imageBox2.Image = abs_grad_x; 126 | 127 | ////【3】求Y方向梯度 128 | //CvInvoke.Sobel(srcimage, grad_y, DepthType.Default, 0, 1); 129 | //CvInvoke.ConvertScaleAbs(grad_y, abs_grad_y, 1, 1); 130 | //imageBox3.Image = abs_grad_y; 131 | 132 | ////【4】合并梯度(近似) 133 | //CvInvoke.AddWeighted(abs_grad_x, 0.5, abs_grad_y, 0.5, 0, dst); 134 | //imageBox4.Image = dst; 135 | 136 | 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormMorphology.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormMorphology 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.comboBox1 = new System.Windows.Forms.ComboBox(); 34 | this.button7 = new System.Windows.Forms.Button(); 35 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 36 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // button1 42 | // 43 | this.button1.Location = new System.Drawing.Point(45, 15); 44 | this.button1.Name = "button1"; 45 | this.button1.Size = new System.Drawing.Size(75, 48); 46 | this.button1.TabIndex = 3; 47 | this.button1.Text = "加载图片"; 48 | this.button1.UseVisualStyleBackColor = true; 49 | this.button1.Click += new System.EventHandler(this.button1_Click); 50 | // 51 | // comboBox1 52 | // 53 | this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 54 | this.comboBox1.FormattingEnabled = true; 55 | this.comboBox1.Items.AddRange(new object[] { 56 | "0.腐蚀Erode", 57 | "1.膨胀Dilate", 58 | "2.开运算Open", 59 | "3.闭运算Close", 60 | "4.梯度Gradient", 61 | "5.顶帽TopHat", 62 | "6.黑帽BlackHat"}); 63 | this.comboBox1.Location = new System.Drawing.Point(176, 23); 64 | this.comboBox1.Name = "comboBox1"; 65 | this.comboBox1.Size = new System.Drawing.Size(236, 29); 66 | this.comboBox1.TabIndex = 9; 67 | // 68 | // button7 69 | // 70 | this.button7.Location = new System.Drawing.Point(189, 69); 71 | this.button7.Name = "button7"; 72 | this.button7.Size = new System.Drawing.Size(75, 48); 73 | this.button7.TabIndex = 10; 74 | this.button7.Text = "运算"; 75 | this.button7.UseVisualStyleBackColor = true; 76 | this.button7.Click += new System.EventHandler(this.button7_Click); 77 | // 78 | // imageBox1 79 | // 80 | this.imageBox1.Location = new System.Drawing.Point(21, 147); 81 | this.imageBox1.Name = "imageBox1"; 82 | this.imageBox1.Size = new System.Drawing.Size(400, 300); 83 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 84 | this.imageBox1.TabIndex = 2; 85 | this.imageBox1.TabStop = false; 86 | // 87 | // imageBox2 88 | // 89 | this.imageBox2.Location = new System.Drawing.Point(448, 147); 90 | this.imageBox2.Name = "imageBox2"; 91 | this.imageBox2.Size = new System.Drawing.Size(400, 300); 92 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 93 | this.imageBox2.TabIndex = 11; 94 | this.imageBox2.TabStop = false; 95 | // 96 | // FormMorphology 97 | // 98 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 99 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 100 | this.ClientSize = new System.Drawing.Size(885, 459); 101 | this.Controls.Add(this.imageBox2); 102 | this.Controls.Add(this.imageBox1); 103 | this.Controls.Add(this.button7); 104 | this.Controls.Add(this.comboBox1); 105 | this.Controls.Add(this.button1); 106 | this.Name = "FormMorphology"; 107 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 108 | this.Text = "形态学"; 109 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 110 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 111 | this.ResumeLayout(false); 112 | 113 | } 114 | 115 | #endregion 116 | 117 | private System.Windows.Forms.Button button1; 118 | private System.Windows.Forms.ComboBox comboBox1; 119 | private System.Windows.Forms.Button button7; 120 | private Emgu.CV.UI.ImageBox imageBox1; 121 | private Emgu.CV.UI.ImageBox imageBox2; 122 | } 123 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBackProjection.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormBackProjection 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.imageBox2 = new Emgu.CV.UI.ImageBox(); 35 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 36 | this.imageBox3 = new Emgu.CV.UI.ImageBox(); 37 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit(); 40 | this.SuspendLayout(); 41 | // 42 | // button1 43 | // 44 | this.button1.Location = new System.Drawing.Point(47, 12); 45 | this.button1.Name = "button1"; 46 | this.button1.Size = new System.Drawing.Size(75, 42); 47 | this.button1.TabIndex = 1; 48 | this.button1.Text = "加载图像"; 49 | this.button1.UseVisualStyleBackColor = true; 50 | this.button1.Click += new System.EventHandler(this.button1_Click); 51 | // 52 | // button2 53 | // 54 | this.button2.Location = new System.Drawing.Point(147, 12); 55 | this.button2.Name = "button2"; 56 | this.button2.Size = new System.Drawing.Size(75, 42); 57 | this.button2.TabIndex = 2; 58 | this.button2.Text = "反向投影"; 59 | this.button2.UseVisualStyleBackColor = true; 60 | this.button2.Click += new System.EventHandler(this.button2_Click); 61 | // 62 | // imageBox2 63 | // 64 | this.imageBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 65 | this.imageBox2.Location = new System.Drawing.Point(322, 88); 66 | this.imageBox2.Name = "imageBox2"; 67 | this.imageBox2.Size = new System.Drawing.Size(293, 246); 68 | this.imageBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 69 | this.imageBox2.TabIndex = 6; 70 | this.imageBox2.TabStop = false; 71 | // 72 | // imageBox1 73 | // 74 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 75 | this.imageBox1.Location = new System.Drawing.Point(28, 88); 76 | this.imageBox1.Name = "imageBox1"; 77 | this.imageBox1.Size = new System.Drawing.Size(288, 246); 78 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 79 | this.imageBox1.TabIndex = 5; 80 | this.imageBox1.TabStop = false; 81 | // 82 | // imageBox3 83 | // 84 | this.imageBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 85 | this.imageBox3.Location = new System.Drawing.Point(621, 88); 86 | this.imageBox3.Name = "imageBox3"; 87 | this.imageBox3.Size = new System.Drawing.Size(293, 246); 88 | this.imageBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 89 | this.imageBox3.TabIndex = 7; 90 | this.imageBox3.TabStop = false; 91 | // 92 | // FormBackProjection 93 | // 94 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 95 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 96 | this.ClientSize = new System.Drawing.Size(942, 422); 97 | this.Controls.Add(this.imageBox3); 98 | this.Controls.Add(this.imageBox2); 99 | this.Controls.Add(this.imageBox1); 100 | this.Controls.Add(this.button2); 101 | this.Controls.Add(this.button1); 102 | this.Name = "FormBackProjection"; 103 | this.Text = "FormBackProjection"; 104 | ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).EndInit(); 105 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 106 | ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).EndInit(); 107 | this.ResumeLayout(false); 108 | 109 | } 110 | 111 | #endregion 112 | 113 | private System.Windows.Forms.Button button1; 114 | private System.Windows.Forms.Button button2; 115 | private Emgu.CV.UI.ImageBox imageBox2; 116 | private Emgu.CV.UI.ImageBox imageBox1; 117 | private Emgu.CV.UI.ImageBox imageBox3; 118 | } 119 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormOCR.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormOCR 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.checkBox1 = new System.Windows.Forms.CheckBox(); 35 | this.checkBox2 = new System.Windows.Forms.CheckBox(); 36 | this.richTextBox1 = new System.Windows.Forms.RichTextBox(); 37 | this.imageBox1 = new Emgu.CV.UI.ImageBox(); 38 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); 39 | this.SuspendLayout(); 40 | // 41 | // button1 42 | // 43 | this.button1.Location = new System.Drawing.Point(109, 12); 44 | this.button1.Name = "button1"; 45 | this.button1.Size = new System.Drawing.Size(75, 44); 46 | this.button1.TabIndex = 1; 47 | this.button1.Text = "加载图像"; 48 | this.button1.UseVisualStyleBackColor = true; 49 | this.button1.Click += new System.EventHandler(this.button1_Click); 50 | // 51 | // button2 52 | // 53 | this.button2.Location = new System.Drawing.Point(215, 12); 54 | this.button2.Name = "button2"; 55 | this.button2.Size = new System.Drawing.Size(75, 44); 56 | this.button2.TabIndex = 2; 57 | this.button2.Text = "识别字符"; 58 | this.button2.UseVisualStyleBackColor = true; 59 | this.button2.Click += new System.EventHandler(this.button2_Click); 60 | // 61 | // checkBox1 62 | // 63 | this.checkBox1.AutoSize = true; 64 | this.checkBox1.Location = new System.Drawing.Point(377, 32); 65 | this.checkBox1.Name = "checkBox1"; 66 | this.checkBox1.Size = new System.Drawing.Size(48, 16); 67 | this.checkBox1.TabIndex = 3; 68 | this.checkBox1.Text = "英语"; 69 | this.checkBox1.UseVisualStyleBackColor = true; 70 | // 71 | // checkBox2 72 | // 73 | this.checkBox2.AutoSize = true; 74 | this.checkBox2.Location = new System.Drawing.Point(461, 32); 75 | this.checkBox2.Name = "checkBox2"; 76 | this.checkBox2.Size = new System.Drawing.Size(48, 16); 77 | this.checkBox2.TabIndex = 4; 78 | this.checkBox2.Text = "汉语"; 79 | this.checkBox2.UseVisualStyleBackColor = true; 80 | // 81 | // richTextBox1 82 | // 83 | this.richTextBox1.Font = new System.Drawing.Font("宋体", 12F); 84 | this.richTextBox1.Location = new System.Drawing.Point(511, 73); 85 | this.richTextBox1.Name = "richTextBox1"; 86 | this.richTextBox1.Size = new System.Drawing.Size(482, 424); 87 | this.richTextBox1.TabIndex = 5; 88 | this.richTextBox1.Text = ""; 89 | // 90 | // imageBox1 91 | // 92 | this.imageBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 93 | this.imageBox1.Location = new System.Drawing.Point(12, 73); 94 | this.imageBox1.Name = "imageBox1"; 95 | this.imageBox1.Size = new System.Drawing.Size(482, 424); 96 | this.imageBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; 97 | this.imageBox1.TabIndex = 2; 98 | this.imageBox1.TabStop = false; 99 | // 100 | // FormOCR 101 | // 102 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 103 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 104 | this.ClientSize = new System.Drawing.Size(1002, 509); 105 | this.Controls.Add(this.imageBox1); 106 | this.Controls.Add(this.richTextBox1); 107 | this.Controls.Add(this.checkBox2); 108 | this.Controls.Add(this.checkBox1); 109 | this.Controls.Add(this.button2); 110 | this.Controls.Add(this.button1); 111 | this.Name = "FormOCR"; 112 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 113 | this.Text = "FormOCR"; 114 | ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).EndInit(); 115 | this.ResumeLayout(false); 116 | this.PerformLayout(); 117 | 118 | } 119 | 120 | #endregion 121 | private System.Windows.Forms.Button button1; 122 | private System.Windows.Forms.Button button2; 123 | private System.Windows.Forms.CheckBox checkBox1; 124 | private System.Windows.Forms.CheckBox checkBox2; 125 | private System.Windows.Forms.RichTextBox richTextBox1; 126 | private Emgu.CV.UI.ImageBox imageBox1; 127 | } 128 | } -------------------------------------------------------------------------------- /EmgucvDemo/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCameraCali.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace EmgucvDemo 2 | { 3 | partial class FormCameraCali 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.imageList1 = new System.Windows.Forms.ImageList(this.components); 33 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 34 | this.pictureBox2 = new System.Windows.Forms.PictureBox(); 35 | this.pictureBox3 = new System.Windows.Forms.PictureBox(); 36 | this.button1 = new System.Windows.Forms.Button(); 37 | this.button2 = new System.Windows.Forms.Button(); 38 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 39 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); 40 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); 41 | this.SuspendLayout(); 42 | // 43 | // imageList1 44 | // 45 | this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 46 | this.imageList1.ImageSize = new System.Drawing.Size(120, 90); 47 | this.imageList1.TransparentColor = System.Drawing.Color.Transparent; 48 | // 49 | // pictureBox1 50 | // 51 | this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 52 | this.pictureBox1.Location = new System.Drawing.Point(23, 30); 53 | this.pictureBox1.Name = "pictureBox1"; 54 | this.pictureBox1.Size = new System.Drawing.Size(284, 226); 55 | this.pictureBox1.TabIndex = 0; 56 | this.pictureBox1.TabStop = false; 57 | // 58 | // pictureBox2 59 | // 60 | this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 61 | this.pictureBox2.Location = new System.Drawing.Point(322, 30); 62 | this.pictureBox2.Name = "pictureBox2"; 63 | this.pictureBox2.Size = new System.Drawing.Size(284, 226); 64 | this.pictureBox2.TabIndex = 1; 65 | this.pictureBox2.TabStop = false; 66 | // 67 | // pictureBox3 68 | // 69 | this.pictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 70 | this.pictureBox3.Location = new System.Drawing.Point(622, 30); 71 | this.pictureBox3.Name = "pictureBox3"; 72 | this.pictureBox3.Size = new System.Drawing.Size(284, 226); 73 | this.pictureBox3.TabIndex = 2; 74 | this.pictureBox3.TabStop = false; 75 | // 76 | // button1 77 | // 78 | this.button1.Location = new System.Drawing.Point(49, 386); 79 | this.button1.Name = "button1"; 80 | this.button1.Size = new System.Drawing.Size(75, 49); 81 | this.button1.TabIndex = 3; 82 | this.button1.Text = "button1"; 83 | this.button1.UseVisualStyleBackColor = true; 84 | this.button1.Click += new System.EventHandler(this.button1_Click); 85 | // 86 | // button2 87 | // 88 | this.button2.Location = new System.Drawing.Point(160, 386); 89 | this.button2.Name = "button2"; 90 | this.button2.Size = new System.Drawing.Size(75, 49); 91 | this.button2.TabIndex = 4; 92 | this.button2.Text = "button2"; 93 | this.button2.UseVisualStyleBackColor = true; 94 | this.button2.Click += new System.EventHandler(this.button2_Click); 95 | // 96 | // FormCameraCali 97 | // 98 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 99 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 100 | this.ClientSize = new System.Drawing.Size(918, 549); 101 | this.Controls.Add(this.button2); 102 | this.Controls.Add(this.button1); 103 | this.Controls.Add(this.pictureBox3); 104 | this.Controls.Add(this.pictureBox2); 105 | this.Controls.Add(this.pictureBox1); 106 | this.Name = "FormCameraCali"; 107 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 108 | this.Text = "FormCameraCali"; 109 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 110 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); 111 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); 112 | this.ResumeLayout(false); 113 | 114 | } 115 | 116 | #endregion 117 | 118 | private System.Windows.Forms.ImageList imageList1; 119 | private System.Windows.Forms.PictureBox pictureBox1; 120 | private System.Windows.Forms.PictureBox pictureBox2; 121 | private System.Windows.Forms.PictureBox pictureBox3; 122 | private System.Windows.Forms.Button button1; 123 | private System.Windows.Forms.Button button2; 124 | } 125 | } -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormAbsDiff.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBinary.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormBlob.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormCircle.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormColor.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /EmgucvDemo/Form/FormContour.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | --------------------------------------------------------------------------------