python PIL图像处理-框选
框选图中位置
代码
from PIL import Image,ImageDraw,ImageFont,ImageFilter
import random #-------------------------------------
#filepath,[837,103][942,208] #图片处理,框选
def pic_rectangle(filepath,bound):
image = Image.open(filepath)
draw = ImageDraw.Draw(image)
# 坐标
x1, y1 =bound[0]
x2, y2 =bound[1]
# outline 外线,fill填充
draw.rectangle((x1, y1, x2, y2), outline="red", width=5)
image.save('filepath', 'jpeg')
#image.show() if __name__=="__main__":
#调用
filepath="./image/name.jpg"
bound=[[744, 276],[1014, 366]]
pic_rectangle(filepath,bound)
python PIL图像处理-框选的更多相关文章
- python PIL 图像处理操作
python PIL 图像处理 # 导入Image库 import Image # 读取图片 im = Image.open("1234.jpg") # 显示图片 im.show( ...
- python PIL 图像处理
python PIL 图像处理 This blog is from: https://www.jianshu.com/p/e8d058767dfa Image读出来的是PIL的类型,而skimage. ...
- python PIL 图像处理库简介(一)
1. Introduction PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处 ...
- python PIL图像处理库
1. Introduction PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处理库了. ...
- python——PIL(图像处理库)
PIL(Python Imaging Library,python图像处理库)提供了通用的图像处理功能,以及大量有用的基本图像操作,如图像缩放,裁剪,旋转,颜色转换等. 1.打开图像并显示 from ...
- python PIL图像处理-生成图片验证码
生成效果如图: 代码 from PIL import Image,ImageDraw,ImageFont,ImageFilter import random # 打开一个jpg图像文件: im = I ...
- python PIL图像处理-图片上添加文字
首先需要安装库pillow cmd安装命令:pip install pillow 安装完后,编写脚本如下: from PIL import Image, ImageDraw, ImageFont de ...
- python PIL图像处理
新建图像 # 三个参数分别代表图像的模式:常用的为RGB(3通道) .RGBA(4通道为透明通道,0为完全透明, 256为不透明) # 第二个参数为图像的长宽参数 # 第三个为默认的填充颜色,RGB时 ...
- Python,PIL压缩裁剪图片
自己写了用来压缩 DC 照片的,批量处理整目录文件,非常方便.需要安装 PIL #!/usr/bin/env python import Image import os import os.path ...
随机推荐
- maven 的plugin 的使用
mvn [plugin-name]:[goal-name] mvn compiler:compile 这里写的十分详细: https://www.tutorialspoint.com/maven/ma ...
- Java 两个整数相除保留两位小数,将小数转化为百分数
Java 两个整数相除保留两位小数,将小数转化为百分数 源于:http://blog.sina.com.cn/s/blog_624d755d0101cvuq.html 后来学习了:http://blo ...
- 1.7-BGP⑥
BGP中的路由控制/过滤: LAB1:Distribute-list调用ACL(较落后) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Step1:通过ACL定义 ...
- [Jest] Use property matchers in snapshot tests with Jest
With the right process in place, snapshot tests can be a great way to detect unintended changes in a ...
- 【Java集合源代码剖析】Hashtable源代码剖析
转载请注明出处:http://blog.csdn.net/ns_code/article/details/36191279 Hashtable简单介绍 Hashtable相同是基于哈希表实现的,相同每 ...
- 卸载完百度影音以后天气助手还在,而且总是自己主动打开ie浏览器,解决方式
今天暴风影音不好用了.我就安装了百度影音,还有意外发现.相同的视频,用百度影音看不清楚,然后我就直接卸载了.结果卸掉以天气小助手还是在,而且总弹白色小框框,各种广告.最忍不了的是还自己主动打开ie浏览 ...
- C++学习笔记22,普通函数重载(1)
转载请注明出处:http://blog.csdn.net/qq844352155/article/details/31353325 该博文仅用于交流学习,请慎用于不论什么商业用途,本博主保留对该博文的 ...
- HDU 5534/ 2015长春区域H.Partial Tree DP
Partial Tree Problem Description In mathematics, and more specifically in graph theory, a tree is an ...
- C# 验证数字的正则表达式集
验证数字的正则表达式集 博客分类: 正则 正则表达式 验证数字的正则表达式集 验证数字:^[0-9]*$ 验证n位的数字:^\d{n}$ 验证至少n位数字:^\d{n,}$ 验证m-n位的数字:^\d ...
- SVM中的线性分类器
线性分类器: 首先给出一个非常非常简单的分类问题(线性可分),我们要用一条直线,将下图中黑色的点和白色的点分开,很显然,图上的这条直线就是我们要求的直线之一(可以有无数条这样的直线) 假如说, ...