Exemple #1
0
        private void toolStripOcr_Click(object sender, EventArgs e)
        {
            string txt = Himg._OcrRecttxt();

            if (txt.Length > 0)
            {
                txt = (RegexCh(txt)).Replace("天津市", "").Replace("东丽区", "");
                ucContents1.Setocrtxt(txt);
            }
        }
Exemple #2
0
 void OcrTask()
 {
     try {
         string loadfile = "";
         GetLog("正在下载文件");
         if (!LoadFileImg(ClsOcr.ArchFile, out loadfile))
         {
             return;
         }
         if (loadfile.Trim().Length <= 0)
         {
             return;
         }
         lsocrconte.Clear();
         List <string> str   = new List <string>();
         List <string> pages = new List <string>();
         GetLog("正在识别文件");
         Himg._OcrRecttxt(loadfile, out str, out pages, ClsOcr.ocr);
         if (str.Count <= 0)
         {
             return;
         }
         for (int i = 0; i < str.Count; i++)
         {
             string strtmp = str[i];
             strtmp = RegexCh(strtmp);
             for (int t = 0; t < lsConten.Count; t++)
             {
                 string s = lsConten[t];
                 if (strtmp.Contains(s))
                 {
                     lsocrconte.Add(s);
                     string lx   = lsContenlx[t];
                     string ywid = Getywid(s).ToString();
                     Addconten(ClsOcr.Archid.ToString(), s, lx, i.ToString(), ywid);
                     break;
                 }
             }
         }
         try {
             if (File.Exists(loadfile))
             {
                 File.Delete(loadfile);
             }
         } catch {
         }
         Common.UpdateOcrTask(ClsOcr.Archid.ToString());
         GetLog("识别完成!");
     } catch (Exception e) {
         GetLog("识别错误:" + e.ToString());
     }
 }