{"id":46,"date":"2015-05-22T13:06:00","date_gmt":"2015-05-22T04:06:00","guid":{"rendered":"https:\/\/www.picolix.jp\/blog\/2015\/05\/ingress-agent-stats-tesseract-ocr.html\/"},"modified":"2019-04-02T10:28:43","modified_gmt":"2019-04-02T01:28:43","slug":"ingress-agent-stats-tesseract-ocr","status":"publish","type":"post","link":"https:\/\/www.picolix.jp\/blog\/2015\/05\/ingress-agent-stats-tesseract-ocr.html","title":{"rendered":"Ingress \u300cAgent Stats\u300d\u304c\u30c7\u30fc\u30bf\u30a2\u30c3\u30d7\u6642\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u3067\u4f7f\u3048\u306a\u3044\u306e\u3067\u3002\u3002 tesseract-ocr\u306e\u30d3\u30eb\u30c9"},"content":{"rendered":"<p>Ingress\u7528\u306eAndroid\u306e\u300cAgent Stats\u300d\u3067\u3059\u304c\u3001Ingress\u306eprofile\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3092\u5171\u6709\u3067\u30b5\u30fc\u30d0\u30b5\u30a4\u30c8\u306b\u9001\u4fe1\u3059\u308b\u3068OCR\u3067\u8aad\u307f\u53d6\u3063\u3066\u304f\u308c\u3066\u3001\u5b9f\u7e3e\u3092\u7ba1\u7406\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3059\u304c\u3001<br \/>\n\u4eba\u6c17\u306a\u306e\u304b\u30b5\u30fc\u30d0\u904e\u8ca0\u8377\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u3067\u5168\u7136\u8a8d\u8b58\u3057\u3066\u304f\u308c\u307e\u305b\u3093\u3002\uff1e\uff1c<\/p>\n<p>\uff08\u672c\u8a18\u4e8b\u306f\u3001\u4e00\u822c\u5411\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u300cAgent Stats\u300d\u3067\u691c\u7d22\u3057\u3066\u6765\u3089\u308c\u305f\u65b9\u306f\u3001<br \/>\n\u304a\u5f79\u306b\u7acb\u3061\u307e\u305b\u3093\u3002\u3059\u307f\u307e\u305b\u3093\u3002\u30a2\u30d7\u30ea\u304c\u5b8c\u6210\u3059\u308c\u3070\u5225\u3067\u3059\u304c\u3002\uff09<\/p>\n<p>\n\u305d\u3053\u3067\u3001\u81ea\u5206\u3067\u4f5c\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u300cAgent Stats\u300d\u306f\u30b5\u30fc\u30d0\u30b5\u30a4\u30c9\u3067\uff2f\uff23\uff32\u3067\u8aad\u307f\u53d6\u3063\u3066<br \/>\n\u3044\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\uff21\uff4e\uff44\uff52\uff4f\uff49\uff44\u7aef\u672b\u5074\u3067\uff2f\uff23\uff32\u6a5f\u80fd\u3092\u5165\u308c\u3066\u8aad\u307f\u53d6\u308c\u306a\u3044\u304b\u307e\u305a\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u7b2c\u4e00\u30b9\u30c6\u30c3\u30d7\uff1aAndroid\u7aef\u672b\u306e\u65b9\u3067OCR\u8a8d\u8b58\u3057\u3066\u3001\u30c7\u30fc\u30bf\u3092\u6587\u5b57\u5217\u306b\u7f6e\u304d\u63db\u3048\u3066\u3067\u304d\u308b\u304b\u3002<br \/>\n\u307e\u305a\u3001Android\u3067OCR\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u3092\u63a2\u3057\u305f\u3068\u3053\u308d\u3001<br \/>\n<a href=\"https:\/\/github.com\/rmtheis\/tess-two\">https:\/\/github.com\/rmtheis\/tess-two<\/a><br \/>\n\u304c\u3042\u308a\u3001\u30cd\u30a4\u30c6\u30a3\u30d6\u30b3\u30fc\u30c9(C\/C++)\u3067\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059\u3002\uff4ani\u3067\u3059\u306e\u3067\u3001Android NDK\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nNDK\u306f\u3001Windows\u3067\u306f\u9762\u5012\u304f\u3055\u3044\u306e\u3067\u3001Linux\uff08CentOS7)\u4e0a\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3010ndk-build\u74b0\u5883\u306e\u69cb\u7bc9\u3011CentOS7<\/p>\n<p>1.Android NDK\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n&nbsp;1) wget http:\/\/dl.google.com\/android\/ndk\/android-ndk-r10e-linux-x86_64.bin<br \/>\n&nbsp;2) chmod +x android-ndk-r10e-linux-x86_64.bin<br \/>\n&nbsp;3) android-ndk-r10e-linux-x86_64.bin<br \/>\n&nbsp;4) mv android-ndk-r10e \/usr\/local\/<br \/>\n&nbsp;5) echo &#8216;export PATH=$PATH:\/usr\/local\/android-ndk-r10e&#8217; &gt;&gt; .bashrc<br \/>\n&nbsp;6) echo &#8216;export NDKROOT=\/usr\/local\/android-ndk-r10e&#8217; &gt;&gt; .bashrc<\/p>\n<p>2.Android SDK\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n&nbsp;1) wget http:\/\/dl.google.com\/android\/android-sdk_r24.2-linux.tgz<br \/>\n&nbsp;2) tar zxvf android-sdk_r24.2-linux.tgz<br \/>\n&nbsp;3) mv android-sdk-linux \/usr\/local\/<br \/>\n&nbsp;4) echo &#8216;export PATH=$PATH:\/usr\/local\/android-sdk-linux\/tools\/&#8217; &gt;&gt; .bashrc<br \/>\n&nbsp;5) echo &#8216;export PATH=$PATH:\/usr\/local\/android-sdk-linux\/platforms&#8217; &gt;&gt; .bashrc<\/p>\n<p>3.\u305d\u306e\u4ed6\u5fc5\u8981\u30e2\u30b8\u30e5\u30fc\u30eb<br \/>\n\u3000\u30d3\u30eb\u30c9\u6642\u3001\/usr\/local\/android-sdk-linux\/build-tools\/22.0.1\/aapt\u5b9f\u884c\u6642\u306b\u5fc5\u8981<br \/>\n\u3000\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u306a\u304f\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u5834\u5408\u306f\u3001\u5fc5\u8981\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u3002<br \/>\n\u3000\u79c1\u306e\u74b0\u5883\u3067\u306f\u3001\u4ee5\u4e0b\uff13\u3064\u304c\u5fc5\u8981\u3067\u3057\u305f\u3002<\/p>\n<p>&nbsp; 1) yum install ld-linux.so.2<br \/>\n&nbsp; 2) yum install libz.so.1<br \/>\n&nbsp; 3) yum install libstdc++.so.6<\/p>\n<p>\u3010tesseract-ocr\u306e\u30d3\u30eb\u30c9\u3011\u3000\u4f5c\u8005\u306b\u611f\u8b1d\u3002<\/p>\n<p>&nbsp;1) git clone git:\/\/github.com\/rmtheis\/tess-two tess<br \/>\n&nbsp;2) cd tess<br \/>\n&nbsp;3) cd tess-two<br \/>\n&nbsp;4) ndk-build<br \/>\n&nbsp;5) android update project &#8211;path .<br \/>\n&nbsp;6) ant release<\/p>\n<p>&nbsp;\u6210\u529f\u3059\u308b\u3068\u4ee5\u4e0b\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n&nbsp;.\/bin\/classes.jar<br \/>\n&nbsp;.\/libs\/armeabi-v7a\/liblept.so<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/libtess.so<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;\/mips\/liblept.so<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/libtess.so<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp;\/x86\/liblept.so<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/libtess.so<\/p>\n<p>&nbsp;\u4ee5\u4e0a\u3092Eclips\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306elibs\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30b3\u30d4\u30fc\u3059\u308c\u3070\u3082\u3046OCR\u8aad\u307f\u53d6\u308a<br \/>\n&nbsp;\u95a2\u6570\u304c\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: left;\">\n<a href=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocr4-4.png\" imageanchor=\"1\" style=\"margin-left: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"320\" src=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocr4-4.png\" width=\"235\" \/><\/a><\/div>\n<p>\n\u3010OCR\u8aad\u307f\u53d6\u308a\u30c4\u30fc\u30eb\u3011Eclips\u306fWindows\u4e0a\u3067\u958b\u767a\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3000\u3000\u3068\u308a\u3042\u3048\u305a\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u307e\u305a\u306f\u6587\u5b57\u304c\u8aad\u3081\u308b\u304b\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>BitmapFactory.Options options = new BitmapFactory.Options();<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>options.inSampleSize = 1;<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>Bitmap bitmap = BitmapFactory.decodeFile(&#8220;\/sdcard\/Pictures\/ingress\/profile_20150507_202910_0.png&#8221;, options);<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\"> <\/span><br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>Log.v(TAG, &#8220;&#8211; START&#8221;);<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>TessBaseAPI baseApi = new TessBaseAPI();<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>baseApi.setDebug(true);<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>baseApi.init(DATA_PATH, lang);<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>baseApi.setImage(bitmap);<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span><br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>String recognizedText = baseApi.getUTF8Text();<br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span><br \/>\n<span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>baseApi.end();<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre;\">  <\/span>Log.v(TAG, &#8220;&#8211; END);<\/p>\n<table border=\"0\">\n<tbody>\n<tr>\n<td>\u8aad\u307f\u53d6\u308a\u753b\u50cf<\/td>\n<td>\u30c6\u30b9\u30c8\u30a2\u30d7\u30ea\u3067\u8aad\u307f\u53d6\u308a\u5f8c<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocr-330x1024.png\" imageanchor=\"1\" style=\"clear: left; float: left; margin-bottom: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"320\" src=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocr-330x1024.png\" width=\"103\" \/><\/a>\n<\/td>\n<td><a href=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocrscreen-576x1024.png\" imageanchor=\"1\" style=\"clear: left; float: left; margin-bottom: 1em; margin-right: 1em;\"><img decoding=\"async\" loading=\"lazy\" border=\"0\" height=\"320\" src=\"https:\/\/www.picolix.jp\/blog\/wp-content\/uploads\/2015\/05\/ocrscreen-576x1024.png\" width=\"180\" \/><\/a>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3059\u3070\u3089\u3057\u3044\u3002\u8aad\u307f\u53d6\u308c\u3066\u308b\uff01\u3002\u8aad\u307f\u53d6\u308a\u6642\u9593\u306f\u3001\u30cd\u30a4\u30c6\u30a3\u30d6\u30b3\u30fc\u30c9\u306b\u3057\u3066\u3082\uff18\u79d2\u7a0b\u5ea6\u304b\u304b\u308a\u307e\u3059\u3002<\/p>\n<div>\n<div>\n\uff08\u91d1\u8272\u306e\u30b0\u30e9\u30c7\u30a3\u30a8\u30fc\u30b7\u30e7\u30f3\u304c\u4fc2\u3063\u3066\u308b\u30bf\u30b0\u6b04\u306f\u6587\u5b57\u5316\u3051\u3057\u3066\u3044\u308b\u3051\u3069\u3053\u308c\u306f\u8aad\u307f\u53d6\u308c\u306a\u304f\u3068\u3082\u3044\u3044\u306e\u3067\uff09<\/p>\n<div>\n\u4f7f\u3048\u308b\u3053\u3068\u304c\u5206\u304b\u3063\u305f\u306e\u3067\u3001\u7b2c\u4e8c\u30b9\u30c6\u30c3\u30d7\u4ee5\u964d\u306f\u6642\u9593\u306e\u3042\u308b\u6642\u306b\u4f5c\u6210\u3057\u307e\u3059\u3002<\/div>\n<div>\n\u3068\u308a\u3042\u3048\u305a\u3001\uff23\uff33\uff36\u306b\u3057\u3066\u30c7\u30fc\u30bf\u3092\u30e1\u30fc\u30eb\u8ee2\u9001\u306a\u3089\u3055\u304f\u3063\u3068\u3067\u304d\u305d\u3046\u3067\u3059\u3002<\/div>\n<div>\n<\/div>\n<div>\n\uff2f\uff23\uff32\u8aad\u307f\u53d6\u308a\u306e\u4f5c\u6210\u90e8\u5206\u306f\u4eca\u5f8c\u3001\u4ed5\u4e8b\u306b\u3082\u751f\u304b\u305b\u305d\u3046\u3067\u3059\u3002<\/div>\n<div>\n<\/p>\n<div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ingress\u7528\u306eAndroid\u306e\u300cAgent Stats\u300d\u3067\u3059\u304c\u3001Ingress\u306eprofile\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3092\u5171\u6709\u3067\u30b5\u30fc\u30d0\u30b5\u30a4\u30c8\u306b\u9001\u4fe1\u3059\u308b\u3068OCR\u3067\u8aad\u307f\u53d6\u3063\u3066\u304f\u308c\u3066\u3001\u5b9f\u7e3e\u3092\u7ba1\u7406\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3059\u304c\u3001 \u4eba\u6c17\u306a\u306e\u304b\u30b5 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.picolix.jp\/blog\/2015\/05\/ingress-agent-stats-tesseract-ocr.html\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Ingress \u300cAgent Stats\u300d\u304c\u30c7\u30fc\u30bf\u30a2\u30c3\u30d7\u6642\u30b5\u30fc\u30d0\u30a8\u30e9\u30fc\u3067\u4f7f\u3048\u306a\u3044\u306e\u3067\u3002\u3002 tesseract-ocr\u306e\u30d3\u30eb\u30c9&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[4,7,6],"_links":{"self":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/46"}],"collection":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":1451,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions\/1451"}],"wp:attachment":[{"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.picolix.jp\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}