Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#.Net中图形的光学标记或字符识别_C#_Ocr_Optical Mark Recognition - Fatal编程技术网

C#.Net中图形的光学标记或字符识别

C#.Net中图形的光学标记或字符识别,c#,ocr,optical-mark-recognition,C#,Ocr,Optical Mark Recognition,不知道从什么开始在这种情况下,我必须从下面的tiff图像提取红色块图像 提取后,我必须阅读图表并获得如下输出:- 如果 1-下班 2卧铺 3-驾驶 4-当值 那么下图应该给出as 2222224333313133133222。应该使用什么算法我正在使用C#作为编程语言也许MODI会帮助您: 更新: 我想,你试的方法是正确的(AForge.net)。 使用Forge.Math.Geometry.SimpleShapeChecker类,您将找到所有矩形。 我会再试一次 已更新 使用Forge.ne

不知道从什么开始在这种情况下,我必须从下面的tiff图像提取红色块图像

提取后,我必须阅读图表并获得如下输出:- 如果 1-下班 2卧铺 3-驾驶 4-当值
那么下图应该给出as 2222224333313133133222。应该使用什么算法我正在使用C#作为编程语言

也许MODI会帮助您:

更新:

我想,你试的方法是正确的(AForge.net)。 使用Forge.Math.Geometry.SimpleShapeChecker类,您将找到所有矩形。 我会再试一次

已更新

使用Forge.net,您可以比较两个图像。在您的问题中,您需要将每个单元格与原始空单元格(标准单元格)进行比较。按相似性排序,所以前24个单元格是(大多数不相似的单元格)您需要的

像这样:

private void ProccessBitmap(Bitmap img, Bitmap original_cell)
    {
        int cellWidth = img.Width / 24;
        int cellHeight = img.Height / 4;
        IList<KeyValuePair<float, Rectangle>> table = new List<KeyValuePair<float, Rectangle>>();
        Bitmap cell;
        Rectangle rect;

        AForge.Imaging.ExhaustiveTemplateMatching tm = new AForge.Imaging.ExhaustiveTemplateMatching(0);

        for (int rowIndex = 0; rowIndex < 4; rowIndex++)
        {
            for (int colIndex = 0; colIndex < 24; colIndex++)
            {
                rect = new Rectangle(colIndex * cellWidth, rowIndex * cellHeight, cellWidth, cellHeight);

                cell = img.Clone(rect, img.PixelFormat);

                var matchings = tm.ProcessImage(original_cell, cell);
                table.Add(new KeyValuePair<float, Rectangle>(matchings[0].Similarity, rect));

                cell.Dispose();
            }
        }

        using (Graphics gr = Graphics.FromImage(img))
        {
            gr.DrawRectangles(new Pen(Color.Red, 3.0f), table.OrderBy(a => a.Key).Take(24).Select(a => a.Value).ToArray());
        }

        pictureBox1.Image = img;
    }
private void进程位图(位图img,位图原始单元格)
{
内部单元宽度=内部单元宽度/24;
内部单元高度=内部高度/4;
IList table=新列表();
位图单元;
矩形矩形;
AForge.Imaging.EXTATEVETemplateMatching tm=新的AForge.Imaging.EXTATEVETemplateMatching(0);
对于(int-rowIndex=0;rowIndex<4;rowIndex++)
{
对于(int-colIndex=0;colIndex<24;colIndex++)
{
rect=新矩形(colIndex*cellWidth,rowIndex*cellHeight,cellWidth,cellHeight);
cell=img.Clone(rect,img.PixelFormat);
var matchings=tm.ProcessImage(原始单元格,单元格);
table.Add(新的KeyValuePair(匹配[0]。相似度,rect));
cell.Dispose();
}
}
使用(Graphics gr=Graphics.FromImage(img))
{
gr.Draw矩形(新画笔(Color.Red,3.0f)、table.OrderBy(a=>a.Key)、Take(24)、Select(a=>a.Value.ToArray());
}
pictureBox1.Image=img;
}

感谢您的快速回复Khurshid。实际上,莫迪无法读取图形。它正在显示垃圾字符,请您帮助使用另一个api或dll。我发现的其中一个Api是forge.net,但我无法找到它。你能浏览原始的tiff图像吗?我想试试我已经发送了图像,请看你是否找到了@khurshidYes,我找到了一些解决方案,但不是完全解决方案:)