最新国产好看的视频,伊人天堂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廢棄... 
''' 

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

相關(guān)文章

最新評(píng)論

叙永县| 江孜县| 江北区| 开阳县| 崇明县| 花垣县| 阆中市| 道孚县| 醴陵市| 威信县| 喜德县| 南靖县| 东丽区| 无棣县| 翁牛特旗| 新安县| 若羌县| 青铜峡市| 甘肃省| 信宜市| 黎城县| 湘潭市| 咸阳市| 霍林郭勒市| 沙湾县| 鹿邑县| 福建省| 康定县| 响水县| 腾冲县| 宝鸡市| 星子县| 枝江市| 巩义市| 娄烦县| 蚌埠市| 贵南县| 太湖县| 石景山区| 浪卡子县| 丹凤县|