python自动截取需要区域,进行图像识别的方法
作者:tonghua1116 时间:2021-05-14 11:04:42
实例如下所示:
import os
os.chdir("G:\Python1\Lib\site-packages\pytesser")
from pytesser import *
from pytesseract import image_to_string
from PIL import Image
from PIL import ImageGrab
#截图,获取需要识别的区域
x = 345
y = 281
m = 462
n = 327
k = 54
for i in range(2,6):
box = (x,y,m,n)
img = ImageGrab.grab(box)
img.save("G:\Python1\Lib\site-packages\pytesser\kangkang"+str(i)+".png")
#img.show()
y+=54
n+=54
#截图完毕后,开始图像识别
names=["kangkang2.png","kangkang3.png","kangkang4.png","kangkang5.png"]
for name in names:
im = Image.open(name)
text = image_to_string(im)
print(name+":"+text)
来源:https://blog.csdn.net/tonghua1116/article/details/54670155
标签:python,图像,识别
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
DreamweaverMX2004的一句话技巧
2009-05-22 18:23:00
利用GAE&Google Gears做了一个简单的AJAX代理
2009-04-29 12:42:00
抛砖:如何进行互联网项目开发
2010-01-25 12:25:00
![](https://img.aspxhome.com/file/UploadPic/20101/25/internet-poject01-87s.jpg)
Javascript编写Asp时需要注意的一些地方
2008-04-06 14:20:00
Javascript调用XML制作连动下拉框
2007-09-17 12:55:00
asp如何实现网上考试功能?
2010-05-24 18:32:00
利用python调用摄像头的实例分析
2022-01-03 22:10:14
Matplotlib 绘制饼图解决文字重叠的方法
2023-06-12 22:23:06
![](https://img.aspxhome.com/file/2023/4/60504_0s.png)
python递归函数绘制分形树的方法
2021-04-22 02:16:02
![](https://img.aspxhome.com/file/2023/9/67339_0s.jpg)
python中常用的内置模块汇总
2023-12-28 14:57:01
![](https://img.aspxhome.com/file/2023/3/65573_0s.png)
几个好用的Asp自定义函数
2007-09-26 14:28:00
重温Javascript继承机制
2011-07-04 12:17:23
python 字典常用方法超详细梳理总结
2023-06-29 05:48:40
javascript禁用Tab键脚本实例
2023-10-13 10:53:58
你是一个职业的页面重构工作者吗?
2008-09-29 12:07:00
《JavaScript语言精粹》译者序及样章试读
2009-04-03 11:38:00
MySQL性能诊断与调优工具
2010-11-02 11:41:00
python 脚本生成随机 字母 + 数字密码功能
2021-11-27 23:37:10
Dreamweaver如何防止及消除垃圾代码的产生
2007-11-13 17:15:00
python中的psutil模块详解(cpu、内存、磁盘情况、结束指定进程)
2021-12-19 23:33:04