博客
关于我
python截取图片
阅读量:227 次
发布时间:2019-02-28

本文共 484 字,大约阅读时间需要 1 分钟。

# -*- coding: utf-8 -*-# @Author  : XerCis# @Time    : 2020/3/18 20:00# @Function: 从图片中选出某一区域,Enter保存import cv2# 读取图片img = '1.jpg'img = cv2.imread(img)cv2.imshow('original', img)# 选择ROIroi = cv2.selectROI(windowName="original", img=img, showCrosshair=True, fromCenter=False)x, y, w, h = roiprint(roi)# 显示ROI并保存图片if roi != (0, 0, 0, 0):    crop = img[y:y+h, x:x+w]    cv2.imshow('crop', crop)    cv2.imwrite('crop.jpg', crop)    print('Saved!')# 退出cv2.waitKey(0)cv2.destroyAllWindows()

转载地址:http://lwvp.baihongyu.com/

你可能感兴趣的文章
Multisim中555定时器使用技巧
查看>>
MySQL CRUD 数据表基础操作实战
查看>>
multisim变压器反馈式_穿过隔离栅供电:认识隔离式直流/ 直流偏置电源
查看>>
mysql csv import meets charset
查看>>
multivariate_normal TypeError: ufunc ‘add‘ output (typecode ‘O‘) could not be coerced to provided……
查看>>
MySQL DBA 数据库优化策略
查看>>
multi_index_container
查看>>
mutiplemap 总结
查看>>
MySQL Error Handling in Stored Procedures---转载
查看>>
MVC 区域功能
查看>>
MySQL FEDERATED 提示
查看>>
mysql generic安装_MySQL 5.6 Generic Binary安装与配置_MySQL
查看>>
Mysql group by
查看>>
MySQL I 有福啦,窗口函数大大提高了取数的效率!
查看>>
mysql id自动增长 初始值 Mysql重置auto_increment初始值
查看>>
MySQL in 太多过慢的 3 种解决方案
查看>>
Mysql Innodb 锁机制
查看>>
MySQL InnoDB中意向锁的作用及原理探
查看>>
MySQL InnoDB事务隔离级别与锁机制深入解析
查看>>
Mysql InnoDB存储引擎 —— 数据页
查看>>