C# OpenCvSharp 车牌颜色识别

C# OpenCvSharp 车牌颜色识别

目录

效果

项目

代码

下载


效果

项目

代码

using OpenCvSharp;

using System;

using System.Diagnostics;

using System.Drawing;

using System.Windows.Forms;

namespace OpenCvSharp_Demo

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

string fileFilter = "图片|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";

string image_path = "";

Mat image;

private void button1_Click(object sender, EventArgs e)

{

OpenFileDialog ofd = new OpenFileDialog();

ofd.Filter = fileFilter;

ofd.InitialDirectory = Application.StartupPath + "\\test_img";

if (ofd.ShowDialog() != DialogResult.OK) return;

pictureBox1.Image = null;

image_path = ofd.FileName;

pictureBox1.Image = new Bitmap(image_path);

textBox1.Text = "";

image = new Mat(image_path);

}

private void Form1_Load(object sender, EventArgs e)

{

image_path = "test_img/1.jpg";

pictureBox1.Image = new Bitmap(image_path);

image = new Mat(image_path);

}

PlateColorCls plateColorCls = new PlateColorCls();

private void button3_Click(object sender, EventArgs e)

{

if (image_path == "")

{

return;

}

Stopwatch stopwatch = new Stopwatch();

stopwatch.Start();

string plateColor = plateColorCls.GetPlateColor(image);

stopwatch.Stop();

textBox1.Text = "耗时:\t\t" + stopwatch.ElapsedMilliseconds + "ms\r\n";

textBox1.Text += "号牌颜色:\t" + plateColor + "\r\n";

textBox1.Text += "-----------------------------\r\n";

textBox1.Text += plateColorCls.GetPixelCountInfo();

}

}

}

using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;

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

        string fileFilter = "图片|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";
        Mat image;

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;

            ofd.InitialDirectory = Application.StartupPath + "\\test_img";

            if (ofd.ShowDialog() != DialogResult.OK) return;
            pictureBox1.Image = null;
            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            textBox1.Text = "";
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            image_path = "test_img/1.jpg";
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        PlateColorCls plateColorCls = new PlateColorCls();

        private void button3_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            string plateColor = plateColorCls.GetPlateColor(image);
            stopwatch.Stop();
            textBox1.Text = "耗时:\t\t" + stopwatch.ElapsedMilliseconds + "ms\r\n";
            textBox1.Text += "号牌颜色:\t" + plateColor + "\r\n";
            textBox1.Text += "-----------------------------\r\n";
            textBox1.Text += plateColorCls.GetPixelCountInfo();
        }
    }
}

下载

源码下载

相关推荐
有Li13 分钟前
跨视角差异-依赖网络用于体积医学图像分割|文献速递-生成式模型与transformer在医学影像中的应用
人工智能·计算机视觉
初九之潜龙勿用21 分钟前
C#校验画布签名图片是否为空白
开发语言·ui·c#·.net
爪哇学长34 分钟前
双指针算法详解:原理、应用场景及代码示例
java·数据结构·算法
Dola_Pan38 分钟前
C语言:数组转换指针的时机
c语言·开发语言·算法
GOTXX42 分钟前
基于Opencv的图像处理软件
图像处理·人工智能·深度学习·opencv·卷积神经网络
繁依Fanyi1 小时前
简易安卓句分器实现
java·服务器·开发语言·算法·eclipse
烦躁的大鼻嘎1 小时前
模拟算法实例讲解:从理论到实践的编程之旅
数据结构·c++·算法·leetcode
xrgs_shz1 小时前
MATLAB读入不同类型图像并显示图像和相关信息
图像处理·计算机视觉·matlab
C++忠实粉丝1 小时前
计算机网络socket编程(4)_TCP socket API 详解
网络·数据结构·c++·网络协议·tcp/ip·计算机网络·算法
用户37791362947552 小时前
【循环神经网络】只会Python,也能让AI写出周杰伦风格的歌词
人工智能·算法