如:,请问怎样把图片里的价格转成字符串格式呢?

解决方案 »

  1.   

    我勒个去啊,参考各种OCR算法
      

  2.   

    图像识别http://topic.csdn.net/u/20100622/15/f8c2f833-99a0-495e-b2ab-44fed5314d8a.html
      

  3.   

    http://www.codeproject.com/KB/recipes/OCR-Chain-Code.aspxOCR识别技术
      

  4.   


    http://www.cnblogs.com/chiname/articles/199856.html
    http://download.csdn.net/source/1830710
    一个源码
      

  5.   

    光学 o
    文字 c
    识别 r
      

  6.   

    一般的OCR都可以识别这种简单的
      

  7.   

    我使用的OCR是Google的tessnet2:string results = "";
    //string datapath = @"D:\temp\tessdata\eng";
    Bitmap image = new Bitmap("C:\\ctl\\1.png");
    tessnet2.Tesseract ocr = new tessnet2.Tesseract();
    ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // 如果只是数字
    //ocr.Init(datapath, "fra", false); // 使用的语言库
    ocr.Init(null, "eng", false);
    List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
    foreach (tessnet2.Word word in result)
      results += string.Format("{0}", word.Text);
    Response.Write(results);上面的代码基本是按他官方的代码,但还是不能准确识别出来!?
      

  8.   

    又试用了一下AspriseOCR.dll,还是没有很好的识别出来
      

  9.   


    我用AspriseOCR测试的非常好,识别数字100%准且,只是没有识别出¥符号~~~
      

  10.   

    http://space.itpub.net/23109131/viewspace-687685
      

  11.   

    使用AspriseOCR做了个测试,识别很好。
    用office组件测试的文件识别率太低!简直无法使用。楼主还是用AspriseOCR来测试吧。附:测试全部代码:
    窗体上textBox1显示文件名,button1打开文件,picturebox1显示打开的图片,textBox2显示识别的文字。测试正常可用。using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;namespace 测试效果
    {
        public partial class ASOCR : Form
        {
            public ASOCR()
            {
                InitializeComponent();
            }
            [DllImport("AspriseOCR.dll", EntryPoint = "OCR")]
            public static extern IntPtr OCR(string file, int type);        [DllImport("AspriseOCR.dll", EntryPoint = "OCRpart")]
            static extern IntPtr OCRpart(string file, int type, int startX, int startY, int width, int height);        [DllImport("AspriseOCR.dll", EntryPoint = "OCRBarCodes")]
            static extern IntPtr OCRBarCodes(string file, int type);        [DllImport("AspriseOCR.dll", EntryPoint = "OCRpartBarCodes")]
            static extern IntPtr OCRpartBarCodes(string file, int type, int startX, int startY, int width, int height);
            private void button1_Click(object sender, EventArgs e)
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "图像文件(*.jpg,*.bmp,*.gif,*.png,*.tif)|*.jpg;*.bmp;*.gif;*.png;*.tif";
                ofd.Multiselect = false;
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    textBox1.Text = ofd.FileName;
                    pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
                    pictureBox1.Image = Image.FromFile(ofd.FileName, false);
                    textBox2.Text = Marshal.PtrToStringAnsi(OCR(ofd.FileName, -1));
                }
            }
        }
    }
      

  12.   


    希望能将你的代码放出来?
    我试了真不不行¥638.00变成了Y 6 n.oo,试了几个也差不多
    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetVeryfyCode("C:\\ctl\\1.png");
            }
        }
        [DllImport("D:\\pd\\Web\\Bin\\AspriseOCR.dll")]
        static extern string OCR(string file, int type);
        private void GetVeryfyCode(string _imgPath)
        {
            string _veryfyCode;
            if (File.Exists(_imgPath))//ok now?
            {
                try
                {
                    //this.picbVeryfyCode.Image = System.Drawing.Bitmap.FromFile(_imgPath);
                    _veryfyCode = OCR(_imgPath, -1);   //将返回string,并以"\r\n"结尾!!
                    //_veryfyCode = _veryfyCode.Substring(0, 4);
                    this.Label1.Text = _veryfyCode;
                }
                catch (Exception e)
                {
                    //MessageBox.Show(e.Message.ToString());
                    throw e;
                }
            }
        }