最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python實(shí)現(xiàn)圖像識(shí)別功能

 更新時(shí)間:2018年01月29日 10:28:32   作者:zoujm-hust12  
這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)圖像識(shí)別功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python實(shí)現(xiàn)圖像識(shí)別的具體代碼,供大家參考,具體內(nèi)容如下

#! /usr/bin/env python 
 
from PIL import Image 
import pytesseract 
 
url='img/denggao.jpeg' 
image=Image.open(url) 
#image=image.convert('RGB') # RGB 
image=image.convert('L') # 灰度 
image.load() 
text=pytesseract.image_to_string(image) 
print text 
#image.show() 
 
r'''''# 
zhongwen_url = 'img/zhongwen003.png' 
import os 
fn = "aaaa" 
# sudo apt-get install tesseract 
cmd = "tesseract " + zhongwen_url + " " + fn + " -l chi_sim" 
os.system(cmd) 
 
with open(fn+".txt", "r") as f: 
  print f 
 
 
ret=os.system('cat /etc/pam.conf') 
print ret 
print '----------------------' 
ret=os.popen('cat /etc/pam.conf') 
print ret''' 
 
r''''' 
import os 
import subprocess 
 
def image_to_string(img, cleanup=True, plus=''): 
  # cleanup為True則識(shí)別完成后刪除生成的文本文件 
  # plus參數(shù)為給tesseract的附加高級(jí)參數(shù) 
  subprocess.check_output('tesseract ' + img + ' ' + 
              img + ' ' + plus, shell=True) # 生成同名txt文件 
  text = '' 
  with open(img + '.txt', 'r') as f: 
    text = f.read().strip() 
  if cleanup: 
    os.remove(img + '.txt') 
  return text 
# run >>> 
# print(image_to_string('./phototest.tif')) # 打印識(shí)別出的文本,刪除txt文件 
# print(image_to_string('./phototest.tif', False)) # 打印識(shí)別出的文本,不刪除txt文件 
# print(image_to_string('./phototest.tif', False, '-l eng')) # 打印識(shí)別出的文本,不刪除txt文件,同時(shí)提供高級(jí)參數(shù) 
 
# PyTesser廢棄... 
''' 

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

桃园县| 潜山县| 大石桥市| 阳泉市| 天峻县| 乳山市| 富川| 达拉特旗| 西乌珠穆沁旗| 远安县| 寿阳县| 师宗县| 苏尼特右旗| 云霄县| 洛川县| 棋牌| 化州市| 双辽市| 富平县| 济源市| 犍为县| 师宗县| 共和县| 都匀市| 济源市| 库车县| 拜泉县| 长沙市| 清新县| 远安县| 石城县| 德保县| 获嘉县| 剑阁县| 桂东县| 织金县| 平定县| 竹北市| 湘西| 巴中市| 临澧县|