在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例C#语言基础 → C# 车牌识别 示例源码

C# 车牌识别 示例源码

C#语言基础

下载此实例
  • 开发语言:C#
  • 实例大小:3.96M
  • 下载次数:108
  • 浏览次数:1064
  • 发布时间:2018-06-10
  • 实例类别:C#语言基础
  • 发 布 人:jhuang
  • 文件格式:.rar
  • 所需积分:5
 相关标签: C#

实例介绍

【实例简介】

【实例截图】

from clipboard


from clipboard

【核心代码】


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Imaging;
using System.Security.Cryptography;
 
//using System.Windows.Forms.SaveFileDialog;
 
namespace sample
{
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class ImageProcess : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button OpenButton;
        private System.Windows.Forms.Button GrayButton;
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.Container components = null;
        private System.Windows.Forms.Button SaveButton;
        private System.Windows.Forms.Panel panel2;
 
        private Bitmap m_Bitmap ;//整幅图像
        private Bitmap m_Bitmap1;
        private Bitmap m_Bitmap2;
        private Bitmap m_Bitmap3;
        private Bitmap c_Bitmap ;//车牌图像
        private int maxX;
        private int maxY;
        Pen pen1=new Pen(Color.Black);
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button InvertButton;
        private System.Windows.Forms.Button BrightButton;
        private System.Windows.Forms.Panel panel4;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Panel GraphyPanel;
        private System.Windows.Forms.Panel LcolorPanel;
        private System.Windows.Forms.GroupBox groupBox4;
 
        private String name;
        private bool aline=false;
        int [] gray=new int[256];
        int [] rr = new int[256];
        int [] gg = new int[256];
        int [] bb = new int[256];
        private float count ;
         
        private float [] gl=new float[256];
        int flag=0;
        private System.Windows.Forms.Button NoiselessButton;
        private System.Windows.Forms.Button MarginalButton;
        private System.Windows.Forms.Button TwoValueButton;
        int xx=-1;
 
        public ImageProcess()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            m_Bitmap = new Bitmap(2,2);
            m_Bitmap1 = new Bitmap(2,2);
                        m_Bitmap2 = new Bitmap(2,2);
                        m_Bitmap3 = new Bitmap(2,2);
            c_Bitmap = new Bitmap(2,2);
            InitializeComponent();
             
 
            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }
 
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }
 
        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageProcess));
            this.OpenButton = new System.Windows.Forms.Button();
            this.GrayButton = new System.Windows.Forms.Button();
            this.SaveButton = new System.Windows.Forms.Button();
            this.panel2 = new System.Windows.Forms.Panel();
            this.panel1 = new System.Windows.Forms.Panel();
            this.GraphyPanel = new System.Windows.Forms.Panel();
            this.InvertButton = new System.Windows.Forms.Button();
            this.BrightButton = new System.Windows.Forms.Button();
            this.panel4 = new System.Windows.Forms.Panel();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.LcolorPanel = new System.Windows.Forms.Panel();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox4 = new System.Windows.Forms.GroupBox();
            this.TwoValueButton = new System.Windows.Forms.Button();
            this.MarginalButton = new System.Windows.Forms.Button();
            this.NoiselessButton = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox4.SuspendLayout();
            this.SuspendLayout();
            //
            // OpenButton
            //
            this.OpenButton.Location = new System.Drawing.Point(8, 24);
            this.OpenButton.Name = "OpenButton";
            this.OpenButton.Size = new System.Drawing.Size(75, 23);
            this.OpenButton.TabIndex = 1;
            this.OpenButton.Text = "Open";
            this.OpenButton.Click  = new System.EventHandler(this.Open_Click);
            //
            // GrayButton
            //
            this.GrayButton.Enabled = false;
            this.GrayButton.Location = new System.Drawing.Point(8, 120);
            this.GrayButton.Name = "GrayButton";
            this.GrayButton.Size = new System.Drawing.Size(75, 23);
            this.GrayButton.TabIndex = 2;
            this.GrayButton.Text = "Gray";
            this.GrayButton.Click  = new System.EventHandler(this.GrayButton_Click);
            //
            // SaveButton
            //
            this.SaveButton.Enabled = false;
            this.SaveButton.Location = new System.Drawing.Point(8, 248);
            this.SaveButton.Name = "SaveButton";
            this.SaveButton.Size = new System.Drawing.Size(75, 23);
            this.SaveButton.TabIndex = 5;
            this.SaveButton.Text = "Save";
            this.SaveButton.Click  = new System.EventHandler(this.SaveButton_Click);
            //
            // panel2
            //
            this.panel2.Location = new System.Drawing.Point(78, 6);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(472, 16);
            this.panel2.TabIndex = 6;
            this.panel2.Paint  = new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
            //
            // panel1
            //
            this.panel1.AutoScroll = true;
            this.panel1.BackColor = System.Drawing.SystemColors.ControlLight;
            this.panel1.Location = new System.Drawing.Point(12, 42);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(324, 264);
            this.panel1.TabIndex = 4;
            this.panel1.Paint  = new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
            //
            // GraphyPanel
            //
            this.GraphyPanel.BackColor = System.Drawing.SystemColors.ControlLight;
            this.GraphyPanel.ForeColor = System.Drawing.Color.Coral;
            this.GraphyPanel.Location = new System.Drawing.Point(360, 156);
            this.GraphyPanel.Name = "GraphyPanel";
            this.GraphyPanel.Size = new System.Drawing.Size(210, 120);
            this.GraphyPanel.TabIndex = 7;
            this.GraphyPanel.Paint  = new System.Windows.Forms.PaintEventHandler(this.GraphyPanel_Paint);
            //
            // InvertButton
            //
            this.InvertButton.Enabled = false;
            this.InvertButton.Location = new System.Drawing.Point(8, 56);
            this.InvertButton.Name = "InvertButton";
            this.InvertButton.Size = new System.Drawing.Size(75, 23);
            this.InvertButton.TabIndex = 10;
            this.InvertButton.Text = "Invert";
            this.InvertButton.Click  = new System.EventHandler(this.InvertButton_Click);
            //
            // BrightButton
            //
            this.BrightButton.Enabled = false;
            this.BrightButton.Location = new System.Drawing.Point(8, 88);
            this.BrightButton.Name = "BrightButton";
            this.BrightButton.Size = new System.Drawing.Size(75, 23);
            this.BrightButton.TabIndex = 11;
            this.BrightButton.Text = "Equalize";
            this.BrightButton.Click  = new System.EventHandler(this.BrightButton_Click);
            //
            // panel4
            //
            this.panel4.BackColor = System.Drawing.SystemColors.ControlLight;
            this.panel4.Location = new System.Drawing.Point(8, 16);
            this.panel4.Name = "panel4";
            this.panel4.Size = new System.Drawing.Size(194, 62);
            this.panel4.TabIndex = 13;
            this.panel4.Paint  = new System.Windows.Forms.PaintEventHandler(this.panel4_Paint);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.panel4);
            this.groupBox1.Location = new System.Drawing.Point(354, 42);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(216, 80);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "车牌";
            this.groupBox1.Enter  = new System.EventHandler(this.groupBox1_Enter);
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.LcolorPanel);
            this.groupBox2.Location = new System.Drawing.Point(354, 132);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(222, 174);
            this.groupBox2.TabIndex = 15;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "直方图";
            this.groupBox2.Enter  = new System.EventHandler(this.groupBox2_Enter);
            //
            // LcolorPanel
            //
            this.LcolorPanel.Location = new System.Drawing.Point(8, 152);
            this.LcolorPanel.Name = "LcolorPanel";
            this.LcolorPanel.Size = new System.Drawing.Size(208, 18);
            this.LcolorPanel.TabIndex = 0;
            this.LcolorPanel.Paint  = new System.Windows.Forms.PaintEventHandler(this.LcolorPanel_Paint);
            //
            // groupBox3
            //
            this.groupBox3.Location = new System.Drawing.Point(6, 24);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(336, 288);
            this.groupBox3.TabIndex = 16;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "待处理图像";
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(6, 6);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(72, 16);
            this.label1.TabIndex = 17;
            this.label1.Text = "文件路径";
            this.label1.Click  = new System.EventHandler(this.label1_Click_2);
            //
            // groupBox4
            //
            this.groupBox4.Controls.Add(this.TwoValueButton);
            this.groupBox4.Controls.Add(this.MarginalButton);
            this.groupBox4.Controls.Add(this.SaveButton);
            this.groupBox4.Controls.Add(this.InvertButton);
            this.groupBox4.Controls.Add(this.OpenButton);
            this.groupBox4.Controls.Add(this.NoiselessButton);
            this.groupBox4.Controls.Add(this.GrayButton);
            this.groupBox4.Controls.Add(this.BrightButton);
            this.groupBox4.Location = new System.Drawing.Point(582, 6);
            this.groupBox4.Name = "groupBox4";
            this.groupBox4.Size = new System.Drawing.Size(88, 300);
            this.groupBox4.TabIndex = 18;
            this.groupBox4.TabStop = false;
            //
            // TwoValueButton
            //
            this.TwoValueButton.Enabled = false;
            this.TwoValueButton.Location = new System.Drawing.Point(8, 216);
            this.TwoValueButton.Name = "TwoValueButton";
            this.TwoValueButton.Size = new System.Drawing.Size(75, 23);
            this.TwoValueButton.TabIndex = 14;
            this.TwoValueButton.Text = "2Value";
            this.TwoValueButton.Click  = new System.EventHandler(this.InciseButton_Click);
            //
            // MarginalButton
            //
            this.MarginalButton.Enabled = false;
            this.MarginalButton.Location = new System.Drawing.Point(8, 184);
            this.MarginalButton.Name = "MarginalButton";
            this.MarginalButton.Size = new System.Drawing.Size(75, 23);
            this.MarginalButton.TabIndex = 13;
            this.MarginalButton.Text = "Marginal";
            this.MarginalButton.Click  = new System.EventHandler(this.MarginalButton_Click_1);
            //
            // NoiselessButton
            //
            this.NoiselessButton.Enabled = false;
            this.NoiselessButton.Location = new System.Drawing.Point(8, 152);
            this.NoiselessButton.Name = "NoiselessButton";
            this.NoiselessButton.Size = new System.Drawing.Size(75, 23);
            this.NoiselessButton.TabIndex = 12;
            this.NoiselessButton.Text = "Noiseless";
            this.NoiselessButton.Click  = new System.EventHandler(this.NoiselessButton_Click);
            //
            // ImageProcess
            //
            this.ClientSize = new System.Drawing.Size(676, 320);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.GraphyPanel);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox4);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.Name = "ImageProcess";
            this.Text = "数字图像处理实验--陈家伟 200345005006";
            this.Load  = new System.EventHandler(this.ImageProcess_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox4.ResumeLayout(false);
            this.ResumeLayout(false);
 
        }
        #endregion
 
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.Run(new ImageProcess());
        }
 
        private void label1_Click(object sender, System.EventArgs e)
        {
             
        }
 
        private void Open_Click(object sender, System.EventArgs e)
        {
             
            BrightButton.Enabled=false;
            NoiselessButton.Enabled=false;
            MarginalButton.Enabled=false;
            TwoValueButton.Enabled=false;
            SaveButton.Enabled=false;
            panel4.Enabled=false;      
 
 
            OpenFileDialog openFileDialog = new OpenFileDialog();
 
            openFileDialog.Filter = "Jpeg文件(*.jpg)|*.jpg|Bitmap文件(*.bmp)|*.bmp| 所有合适文件(*.bmp/*.jpg)|*.bmp/*.jpg";  
 
            openFileDialog.FilterIndex = 2 ;
 
            openFileDialog.RestoreDirectory = true ;
 
            if(DialogResult.OK == openFileDialog.ShowDialog())
 
            {
                name = openFileDialog.FileName;
                m_Bitmap = (Bitmap)Bitmap.FromFile(name, false);
 
                this.panel1.AutoScroll = true;
 
                this.panel1.AutoScrollMinSize=new Size ((int)(m_Bitmap.Width),(int)
 
                    m_Bitmap.Height);
 
                this.InvertButton.Enabled=true;
                this.GrayButton.Enabled=true;
                 
 
                panel1.Invalidate();
                panel2.Invalidate();
                panel4.Invalidate();
 
            }
 
        }
 
        private void ImageProcess_Load(object sender, System.EventArgs e)
        {
             
        }
 
        private void hScrollBar1_Scroll(object sender, System.Windows.Forms.ScrollEventArgs e)
        {
            panel1.Invalidate();
        }
 
        private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.DrawImage(m_Bitmap, new Rectangle(this.panel1.AutoScrollPosition.X, this.panel1.AutoScrollPosition.Y,
                (int)(m_Bitmap.Width), (int)(m_Bitmap.Height)));
 
        }
 
        private void SaveButton_Click(object sender, System.EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Bitmap文件(*.bmp)|*.bmp| Jpeg文件(*.jpg)|*.jpg| 所有合适文件(*.bmp/*.jpg)|*.bmp/*.jpg";
            saveFileDialog.FilterIndex = 1 ;
 
            saveFileDialog.RestoreDirectory = true ;
 
            if(DialogResult.OK == saveFileDialog.ShowDialog())
 
            {
                c_Bitmap.Save(saveFileDialog.FileName);
 
            }
 
        }
 
        private void panel2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.DrawString(name,new Font("Arial", 8), new SolidBrush(Color.Black),0,0);
        }
 
        private void label1_Click_1(object sender, System.EventArgs e)
        {
         
        }
 
        private void InvertButton_Click(object sender, System.EventArgs e)
        {
            if(Filters.Invert(m_Bitmap,out gray))
            {
                LcolorPanel.Invalidate();
                graydo();
            }
 
        }
 
 
        private void GraphyPanel_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            int p;
            p = m_Bitmap.Width*m_Bitmap.Height;
        //  this.l_pixel.Text=p.ToString();
 
            int height =this.GraphyPanel.Height;
            for(int j=0;j<256;j  )
            {
                if(gl[j]>height)
                    gl[j]=height;
                g.DrawLine(pen1,j,height,j,height-gl[j]);
            }
            if(aline)
            {
                g.DrawLine(Pens.OrangeRed,xx,0,xx,height);  
            }
        }
 
        private void GraphyPanel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            xx=e.X;
            if(xx>255)
                xx=255;
            if(xx<=0)
                xx=0;
    
            aline=true;
            this.GraphyPanel.Invalidate();
        }
 
        private void GraphyPanel_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point p=new Point(e.X,e.Y);
            if(new Rectangle(0,0,256,127).Contains(p))
            {
                this.xx=e.X;
            }
            else
            {
                this.xx=-1;
            }
    
            this.GraphyPanel.Invalidate();
        }
 
        private void GraphyPanel_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            aline=false;
        }
 
        private void LcolorPanel_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            int width=this.LcolorPanel.Width;
            int height=this.LcolorPanel.Height;
            int j;
            Color c;
            Graphics g=e.Graphics;
 
            switch(flag)
            {
                case 1:
                {
                    for(int i=width;i>=0;i--)
                    {
                        j=i;
                        if(j>255) j=255;
                        c=Color.FromArgb(j,j,j);
                        Pen pen2=new Pen(c,1);  
                        g.DrawLine(pen2,i,0,i,height);
                    }
                    break;
                }
                case 2:
                {
                    for(int i=width;i>=0;i--)
                    {
                        j=i;
                        if(j>255) j=255;
                        c=Color.FromArgb(j,0,0);
                        Pen pen2=new Pen(c,1);  
                        g.DrawLine(pen2,i,0,i,height);
                    }
                    break;
                }
                case 3:
                {
                    for(int i=width;i>=0;i--)
                    {
                        j=i;
                        if(j>255) j=255;
                        c=Color.FromArgb(0,j,0);
                        Pen pen2=new Pen(c,1);  
                        g.DrawLine(pen2,i,0,i,height);
                    }
                    break;
                }
                case 4:
                {
                    for(int i=width;i>=0;i--)
                    {
                        j=i;
                        if(j>255) j=255;
                        c=Color.FromArgb(0,0,j);
                        Pen pen2=new Pen(c,1);  
                        g.DrawLine(pen2,i,0,i,height);
                    }
                    break;
                }
                default:
                    break;
 
            }
        }
 
        private void GrayButton_Click(object sender, System.EventArgs e)
        {
            Filters.zft(m_Bitmap,out gray,out rr,out gg, out bb);
            this.BrightButton.Enabled=true;
            this.NoiselessButton.Enabled=true;
            LcolorPanel.Invalidate();
            graydo();
         
        }
 
        private void BrightButton_Click(object sender, System.EventArgs e)
        {
         
            if(Filters.Brightness(m_Bitmap,gray,out gray,(int)count) )
                graydo();
 
        }
 
        private void label2_Click(object sender, System.EventArgs e)
        {
         
        }
 
        private void panel4_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Point ulCorner = new Point( 0, 0);
            g.DrawImage(c_Bitmap,0,0);
            //g.DrawImage(c_Bitmap, new Rectangle(this.panel1.AutoScrollPosition.X, this.panel1.AutoScrollPosition.Y,
            //  (int)(c_Bitmap.Width), (int)(c_Bitmap.Height)));
        }
 
        private void groupBox1_Enter(object sender, System.EventArgs e)
        {
         
        }
 
        private void label1_Click_2(object sender, System.EventArgs e)
        {
         
        }
 
        private void groupBox2_Enter(object sender, System.EventArgs e)
        {
         
        }
        private void graydo()
        {
            this.flag=1;
            count = m_Bitmap.Width * m_Bitmap.Height;
            gl=new float[256];
            for(int i=0;i<256; i  )
                gl[i]= gray[i]/count *1500;
            pen1=Pens.Red;
            panel1.Invalidate();
            GraphyPanel.Invalidate();
        }
 
        private void NoiselessButton_Click(object sender, System.EventArgs e)
        {
            if(Filters.GaussianFilter(m_Bitmap,out gray))
                graydo();
            this.MarginalButton.Enabled=true;
        }
 
        private void MarginalButton_Click_1(object sender, System.EventArgs e)
        {
            int ccount;
            int yl,yr,xu,xd;
            if (Filters.MarginalFilter(m_Bitmap,out gray,out ccount ,67,out xu,out xd,out yl,out yr,out maxX,out maxY)) {
             
                m_Bitmap1 = (Bitmap)Bitmap.FromFile(name, false);
                Rectangle sourceRectangle = new Rectangle(yl,xu,yr-yl,xd-xu);
                c_Bitmap= m_Bitmap1.Clone(sourceRectangle,
                    PixelFormat.DontCare);
                groupBox1.Text="车牌";
                groupBox1.Invalidate();
                 
                this.SaveButton.Enabled=true;
                this.TwoValueButton.Enabled=true;
                panel4.Invalidate();
                graydo();
            }
        }
 
 
        private void textBox1_TextChanged(object sender, System.EventArgs e)
        {
         
        }
 
        private void InciseButton_Click(object sender, System.EventArgs e)
        {
             
            Filters.zft(c_Bitmap,out gray,out rr,out gg, out bb);
            Rectangle sourceRectangle = new Rectangle(maxY,maxX,66,14);
            Bitmap xc_Bitmap=c_Bitmap.Clone(sourceRectangle,
                PixelFormat.DontCare);
            if (Filters.TowValue(c_Bitmap,xc_Bitmap,maxY,maxY)) {
                groupBox1.Text="车牌(经二值化处理)";
                groupBox1.Invalidate();
                panel4.Invalidate();
            }
        }
 
    }
}


标签: C#

实例下载地址

C# 车牌识别 示例源码

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

第 1 楼 wujianwei123 发表于: 2019-05-28 20:00 11
老哥,这个不能实现图像提取出来应该有的字母吗

支持(0) 盖楼(回复)

发表评论

(您的评论需要经过审核才能显示)

查看所有1条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警