python+opencv 读取文件夹下的所有图像并批量保存ROI的方法
作者:zhangxu_bme 时间:2021-02-23 13:07:23
如下所示:
import cv2
import os
import numpy as np
root_path = "I:/Images/2017_08_03/"
dir = root_path+"images"+"/"
count = 0
for root,dir,files in os.walk(dir):
for file in files:
srcImg = cv2.imread(root_path+"images"+"/"+str(file))
roiImg = srcImg[36:521, 180:745]
cv2.imwrite(root_path+"Image"+"/"+str(file),roiImg)
count +=1
if count%400==0:
print count
来源:https://blog.csdn.net/chengzhongxuyou/article/details/76823964
标签:python,opencv,图像,ROI
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
pytorch下的unsqueeze和squeeze的用法说明
2023-07-16 14:01:41
![](https://img.aspxhome.com/file/2023/6/63576_0s.jpg)
分析并输出Python代码依赖的库的实现代码
2022-04-05 17:07:23
Python实现轻松切割MP3文件
2023-09-23 21:40:32
![](https://img.aspxhome.com/file/2023/5/62605_0s.png)
python抓取京东商城手机列表url实例代码
2022-11-11 18:23:04
OpenCV-Python实现图像梯度与Sobel滤波器
2021-04-07 05:23:20
![](https://img.aspxhome.com/file/2023/5/82535_0s.png)
Ajax的错误处理机制探讨
2007-09-07 09:53:00
python抽象基类用法实例分析
2021-03-04 11:06:25
python调用matlab的m自定义函数方法
2023-11-11 21:40:52
在Python中使用cookielib和urllib2配合PyQuery抓取网页信息
2023-10-12 14:15:19
![](https://img.aspxhome.com/file/2023/1/79741_0s.png)
浅谈python的elementtree模块处理中文注意事项
2021-06-17 12:02:46
python实现监控指定进程的cpu和内存使用率
2023-08-23 02:21:17
![](https://img.aspxhome.com/file/2023/3/62003_0s.jpg)
增加 javascript 的 trim 函数
2008-04-20 16:54:00
python爬取cnvd漏洞库信息的实例
2021-08-24 07:18:06
![](https://img.aspxhome.com/file/2023/3/79633_0s.jpg)
Python基于百度API识别并提取图片中文字
2023-02-06 13:51:25
![](https://img.aspxhome.com/file/2023/6/84946_0s.jpg)
关于window.opener的用法
2008-02-23 11:03:00
Python3 assert断言实现原理解析
2023-06-11 20:39:33
Go/Python/Erlang编程语言对比分析及示例代码
2022-08-15 17:19:12
![](https://img.aspxhome.com/file/2023/9/79649_0s.jpg)
ajax代理程序,自动判断字符编码
2007-11-04 13:17:00
用户体验的误解
2008-07-15 12:31:00
linux下安装apache与php;Apache+PHP+MySQL配置攻略
2023-11-14 15:43:46