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

首頁 > 編程 > Python > 正文

python實現圖像識別功能

2020-01-04 16:02:52
字體:
來源:轉載
供稿:網友

本文實例為大家分享了python實現圖像識別的具體代碼,供大家參考,具體內容如下

#! /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則識別完成后刪除生成的文本文件   # plus參數為給tesseract的附加高級參數   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')) # 打印識別出的文本,刪除txt文件 # print(image_to_string('./phototest.tif', False)) # 打印識別出的文本,不刪除txt文件 # print(image_to_string('./phototest.tif', False, '-l eng')) # 打印識別出的文本,不刪除txt文件,同時提供高級參數  # PyTesser廢棄... ''' 

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到python教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 旬邑县| 巴东县| 武冈市| 凌海市| 稻城县| 德钦县| 荆州市| 乐亭县| 文昌市| 江达县| 长春市| 丽江市| 贵定县| 洱源县| 蒙山县| 兖州市| 林州市| 镇江市| 方山县| 濮阳市| 淮阳县| 霍城县| 崇义县| 故城县| 四子王旗| 邮箱| 通州市| 兰溪市| 卓尼县| 聂拉木县| 南宫市| 喜德县| 宁蒗| 平利县| 苍梧县| 汉寿县| 家居| 宁阳县| 酉阳| 额尔古纳市| 玉环县|