国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

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

2020-02-22 23:01:34
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

本文實(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為T(mén)rue則識(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í)有所幫助,也希望大家多多支持武林站長(zhǎng)站。

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 荔浦县| 台安县| 荥阳市| 阜南县| 内江市| 石林| 石屏县| 河间市| 肥乡县| 桦甸市| 高邮市| 岚皋县| 合阳县| 扶风县| 溆浦县| 东阿县| 海阳市| 武乡县| 合山市| 茌平县| 麻城市| 临潭县| 木兰县| 焦作市| 仙桃市| 卢氏县| 南丰县| 延川县| 台湾省| 民权县| 讷河市| 时尚| 洛川县| 盐城市| 彝良县| 邳州市| 汕头市| 定兴县| 昌邑市| 温州市| 芜湖县|