• paip.验证码识别分割.使用投影直方图


    paip.验证码识别---分割.--使用投影直方图

     

    验证码识别的时候,需要纵向分割字符。需要识别字符的边界..此时可以使用投影直方图

    1.做y轴的投影    2. 在直方图观察像素的分布

     

     

     

    C#代码

    Bitmap projectHistogram(Bitmapbmp)

            {

     

                // stats

                if (histo!= null)

                    histo= null;

     

                int width=bmp.Width;

                int height=bmp.Height;

     

                histo= new int[width];

     

                for (int y=0; y<height; y++)

                    for (int x=0; x<width; x++)

                    {

                        Color color=bmp.GetPixel(x, y);

     

                        if (color.R<50&&color.G<50&&color.B<50)

                            //if (color.A > 200)

                            histo[x]++;

                    }

     

                // draw

                //int max = getMax(histo);

     

                Bitmap tmp= new Bitmap(width, height);

                using (Graphics g=Graphics.FromImage(tmp))

                    for (int i=0; i<width; i++)

                        g.DrawLine(

                            Pens.Black,

                            i,

                            height,

                            i,

                            height-histo[i]);

     

                return tmp;

            }

     

     

     

    参考

    图像识别练习(字符验证码、车牌号、身份证号)

  • 相关阅读:
    ps制作gif
    安装pycocotools错误
    labelimg最新版本的使用攻略
    1_0day安全漏洞分析技术学习_二进制文件概述_笔记
    2.陈治瑄问题,汉字写入数据库报错。这个汉字有什么特殊的吗?
    1.PHP中报出use of undefined constant count
    [转] 关于Multi-head的为什么
    [转] GPT、GPT-2到GPT-3概览
    [转] RoBERTa介绍
    [转] ELMo原理解析及简单上手使用
  • 原文地址:https://www.cnblogs.com/attilax/p/15199850.html
Copyright © 2020-2023  润新知