æã家ã«ã¯ã¿ãããã¨ãããã³ã¯ããã ã¹ã¿ã¼(é·æ¯ç¨®)ã¨ãã天使ããããã¨ã¯ååã自動エアコン調整システムを考える(1) - 部屋の間取りとシステムの基本構成 - 酢ろぐ!ãã®è¨äºã§æ¸ãã¾ãããä»åã¯å®¤æ¸©ãåå¾ããããã«ã©ããããè¯ãã®ããæ¤è¨ãã¦ããã¾ãããã
- NuGetãããtesseract-ocrããã¤ã³ã¹ãã¼ã«ãã
- C#ããtesseract-ocrã使ã£ã¦OCRãã
- 解æããé åãæå®ãããã¨ã§ç²¾åº¦ãä¸ãã
- æ¤åºããæåããããããæå®ãããã¨ã§ç²¾åº¦ãä¸ãã
- ããå¦ç¿ãã¦ããè±èªã®.traineddataã使ã£ã¦ç²¾åº¦ãä¸ãã
ä¸ã®ç»åã¯ã¿ãããã²ã¼ã¸ã«è¨ç½®ããããããã¯ã¼ã¯ã«ã¡ã©ããåºåãããç»åã§ã温度ã»ã³ãµã¼ãã¤ãã¦ãããã®å¤ãç»åå³ä¸ã«åºåããã¦ãã¾ãããããã¯ã¼ã¯ã«ã¡ã©ã¯ãã«ã¡ã©ä¸çºï¼ããè¨ç½®ãã¦ãã¾ãã
PLANEX ã«ã¡ã©ä¸çº! Wi-Fi/æç·å¯¾å¿ 100ä¸ç»ç´ ãããã¯ã¼ã¯ã«ã¡ã© CS-W60HD
- åºç社/ã¡ã¼ã«ã¼: ãã©ããã¯ã¹
- çºå£²æ¥: 2013/12/25
- ã¡ãã£ã¢: Personal Computers
- ãã®ååãå«ãããã°ãè¦ã
ã¦ã£ã¨ãæ©ããæ¸ã¾ãããã®ã§ãOCRã使ã£ã¦æåãèªèããããã¨æãã¾ãã
C#ãã使ããOCRã©ã¤ãã©ãªã§ãNuGetããã¤ã³ã¹ãã¼ã«å¯è½ãªãã®ã®ã²ã¨ã¤ã«ãtesseract-ocrããããã¾ãã
NuGetãããtesseract-ocrããã¤ã³ã¹ãã¼ã«ãã
NuGetã§ãtesseract-ocrããã¤ã³ã¹ãã¼ã«ãã¾ãã
ããã§C#ããtesseract-ocrã使ãæºåãæ´ãã¾ãããdllã¢ã»ã³ããªãåç §æ¸ã¿ã§ããWindowsã¹ãã¢ã¢ããªãWindows Phoneã¢ããªãä½ãã®ã§ãNuGetã¯éå®ãã¾ãã®ã§Visual Studioã使ã£ã¦éçºããã¦ããæ¹ã¯æ¯éãå©ç¨ãã ããã
C#ããtesseract-ocrã使ã£ã¦OCRãã
tesseract-ocrã使ãããã«ã¯ã'.traineddataæ¡å¼µå'ã®å¦ç¿ãã¼ã¿ãå¿ è¦ã«ãªãã¾ããå¦ç¿ãã¼ã¿ã¯èªåã§ä½ããã¨ãã§ãã¾ãããæéãæãã¾ãªãæ¹åã§ä¸è¨ã®ãã¼ã¸ãããã¦ã³ãã¼ãããã¨è¯ãããããã¾ããã
è±èªã¨æ¥æ¬èªã®å¦ç¿ãã¼ã¿ããã¦ã³ãã¼ããã¾ãã.tar.gzãªã®ã§ä»»æã®ãã©ã«ãã«è§£åãã¦ããã¾ãããã
- jpn
- eng
ã¾ãã¯ãtesseract-ocrã使ã£ã¦æååãèªèãããããã®ã³ã¼ãã®åºæ¬å½¢ã¯ã以ä¸ã®ã³ã¼ãã®éãã§ãã
// 解æãããç»åã®ãã¡ã¤ã«ãã¹ var imgPath = @"C:\Users\ch3cooh\Desktop\unnamed.jpg"; // jpn.traineddataçã®å¦ç¿ãã¼ã¿ãæ ¼ç´ããããã£ã¬ã¯ããªãã¹ var dataDirPath = @"C:\Users\ch3cooh\Desktop\tessdata"; // 使ç¨ããå¦ç¿ãã¼ã¿ã®è¨èª(ãã£ã¬ã¯ããªãã¹ã«æ ¼ç´ããã¦ããè¨èªã«éã) var lang = "jpn"; using (var image = new System.Drawing.Bitmap(imgPath)) { using (var engine = new Tesseract.TesseractEngine(dataDirPath, lang)) using (var page = engine.Process(image)) { var resultText = page.GetText(); Console.Write(resultText); } }
çµæã¯ãããªæãã
\n\n
æ¹è¡ã³ã¼ãã2ã¤ãä½æ ãªã®ãâ¦â¦
解æããé åãæå®ãããã¨ã§ç²¾åº¦ãä¸ãã
å ã»ã©è¨ããã³ã¼ãã¯ãOCRããããã®æå°éã®ã³ã¼ãã§ããã®ã§ãç»å解æãã対象ãç»åå ¨ä½ãæå®ãã¦ãã¾ããããã¾ãã«ãéã ã£ãããã§ããã¡ãã¡ã§ãã®ã§è§£æããã®ãæä½éã®é åãæå®ãã¾ãã
解æãããã®ã¯ãä¸å³ã®æ¥ä»ã¨æ¸©åº¦ã®ã¨ããã ãã§ãã
ã¿ã¼ã²ããç»åãåãè²¼ãããã®ãè¯ãã®ã§ãããteaser act-ocrã«ã¯æå®ãããé åã ãã®è§£æãããæ¹æ³ãç¨æããã¦ãã¾ãã
Tesseract.Rectã¯ã©ã¹
ã®ã¤ã³ã¹ã¿ã³ã¹ãçæãã¦
ï½çç¥ï½ // å¦çããé åãæå®ãã¾ã var rect = new Tesseract.Rect(0, 0, 286, 20); // 解æã¨ã³ã¸ã³ãçæãã¦ãæå®ããè¨èªã®å¦ç¿ãã¼ã¿ã使ã£ã¦è§£æ using (var engine = new Tesseract.TesseractEngine(dataDirPath, lang)) using (var page = engine.Process(image, rect)) { var resultText = page.GetText(); Console.Write(resultText); } }
çµæã¯ãããªæãã
20ã¼4/é"7/ ã¼2 ã¼g=ã¼6=37 26ãC
ãã¼ããå¾®å¦â¦â¦
æ¤åºããæåããããããæå®ãããã¨ã§ç²¾åº¦ãä¸ãã
使ç¨ããæåãéå®ãã¦OCR精度ãä¸ãã¾ãã
ï½çç¥ï½ // 解æã¨ã³ã¸ã³ãçæãã¦ãæå®ããè¨èªã®å¦ç¿ãã¼ã¿ã使ã£ã¦è§£æ using (var engine = new Tesseract.TesseractEngine(dataDirPath, lang)) { // 解æçµæã«æ°åã ãã表示ãããããã«ãã engine.SetVariable("tessedit_char_whitelist", "0123456789/:C"); using (var page = engine.Process(image, rect)) { var resultText = page.GetText(); Console.Write(resultText); } } }
çµæã¯ãããªæãã
20ã¼4/ 7/ ã¼2 9 ã¼6 37 26 C
ããå¦ç¿ãã¦ããè±èªã®.traineddataã使ã£ã¦ç²¾åº¦ãä¸ãã
åå¾ãããã®ã¯è¨å·+æ°åé¨åã ããªã®ã§ã使ç¨è¨èªã«eng
ãæå®ãã¾ãã
// 使ç¨ããå¦ç¿ãã¼ã¿ã®è¨èª(ãã£ã¬ã¯ããªãã¹ã«æ ¼ç´ããã¦ããè¨èªã«éã) var lang = "eng";
çµæã¯ãããªæãã
2014/67/12 19:16:37 26 C
ç£è¦ã«ã¡ã©ã®ç»åãOCRã«ãããçµæãã2014/07/12 19:16:37 26âããã2014/67/12 19:16:37 26 Cãã¨è§£æããã¨ããã¾ã§ã¯ã§ããããã«ãªã£ãã