首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

C# OpenCvSharp 车牌颜色识别

  • 25-02-19 03:40
  • 2132
  • 10768
blog.csdn.net

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();
        }
    }
}

  1. using OpenCvSharp;
  2. using System;
  3. using System.Diagnostics;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. namespace OpenCvSharp_Demo
  7. {
  8. public partial class Form1 : Form
  9. {
  10. public Form1()
  11. {
  12. InitializeComponent();
  13. }
  14. string fileFilter = "图片|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
  15. string image_path = "";
  16. Mat image;
  17. private void button1_Click(object sender, EventArgs e)
  18. {
  19. OpenFileDialog ofd = new OpenFileDialog();
  20. ofd.Filter = fileFilter;
  21. ofd.InitialDirectory = Application.StartupPath + "\\test_img";
  22. if (ofd.ShowDialog() != DialogResult.OK) return;
  23. pictureBox1.Image = null;
  24. image_path = ofd.FileName;
  25. pictureBox1.Image = new Bitmap(image_path);
  26. textBox1.Text = "";
  27. image = new Mat(image_path);
  28. }
  29. private void Form1_Load(object sender, EventArgs e)
  30. {
  31. image_path = "test_img/1.jpg";
  32. pictureBox1.Image = new Bitmap(image_path);
  33. image = new Mat(image_path);
  34. }
  35. PlateColorCls plateColorCls = new PlateColorCls();
  36. private void button3_Click(object sender, EventArgs e)
  37. {
  38. if (image_path == "")
  39. {
  40. return;
  41. }
  42. Stopwatch stopwatch = new Stopwatch();
  43. stopwatch.Start();
  44. string plateColor = plateColorCls.GetPlateColor(image);
  45. stopwatch.Stop();
  46. textBox1.Text = "耗时:\t\t" + stopwatch.ElapsedMilliseconds + "ms\r\n";
  47. textBox1.Text += "号牌颜色:\t" + plateColor + "\r\n";
  48. textBox1.Text += "-----------------------------\r\n";
  49. textBox1.Text += plateColorCls.GetPixelCountInfo();
  50. }
  51. }
  52. }

下载

源码下载

天天代码码天天
微信公众号
.NET 人工智能实践
注:本文转载自blog.csdn.net的天天代码码天天的文章"https://lw112190.blog.csdn.net/article/details/139769668"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2492) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

101
推荐
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top