毕业设计 python opencv实现车牌识别 矩形矫正
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506
GitHub:https://github.com/yinghualuowu
答辩通过了,补完~
用的是仿射变换
def img_Transform(car_contours,oldimg,pic_width,pic_hight):
car_imgs = []
for car_rect in car_contours:
if car_rect[2] > -1 and car_rect[2] < 1:
angle = 1
# 对于角度为-1 1之间时,默认为1
else:
angle = car_rect[2]
car_rect = (car_rect[0], (car_rect[1][0] + 5, car_rect[1][1] + 5), angle)
box = cv2.boxPoints(car_rect) heigth_point = right_point = [0, 0]
left_point = low_point = [pic_width, pic_hight]
for point in box:
if left_point[0] > point[0]:
left_point = point
if low_point[1] > point[1]:
low_point = point
if heigth_point[1] < point[1]:
heigth_point = point
if right_point[0] < point[0]:
right_point = point if left_point[1] <= right_point[1]: # 正角度
new_right_point = [right_point[0], heigth_point[1]]
pts2 = np.float32([left_point, heigth_point, new_right_point]) # 字符只是高度需要改变
pts1 = np.float32([left_point, heigth_point, right_point])
M = cv2.getAffineTransform(pts1, pts2)
dst = cv2.warpAffine(oldimg, M, (pic_width, pic_hight))
point_limit(new_right_point)
point_limit(heigth_point)
point_limit(left_point)
car_img = dst[int(left_point[1]):int(heigth_point[1]), int(left_point[0]):int(new_right_point[0])]
car_imgs.append(car_img) elif left_point[1] > right_point[1]: # 负角度
new_left_point = [left_point[0], heigth_point[1]]
pts2 = np.float32([new_left_point, heigth_point, right_point]) # 字符只是高度需要改变
pts1 = np.float32([left_point, heigth_point, right_point])
M = cv2.getAffineTransform(pts1, pts2)
dst = cv2.warpAffine(oldimg, M, (pic_width, pic_hight))
point_limit(right_point)
point_limit(heigth_point)
point_limit(new_left_point)
car_img = dst[int(right_point[1]):int(heigth_point[1]), int(new_left_point[0]):int(right_point[0])]
car_imgs.append(car_img) return car_imgs
毕业设计 python opencv实现车牌识别 矩形矫正的更多相关文章
- 毕业设计 python opencv实现车牌识别 界面
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- 毕业设计 python opencv实现车牌识别 颜色判断
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- 毕业设计 python opencv实现车牌识别 形状定位
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- 毕业设计 python opencv实现车牌识别 颜色定位
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- 毕业设计 python opencv实现车牌识别 预处理
主要代码参考https://blog.csdn.net/wzh191920/article/details/79589506 GitHub:https://github.com/yinghualuow ...
- 毕业设计 python opencv实现车牌识别 码云地址
码云地址:https://gitee.com/yinghualuowu/Python_VLPR 删除了冗余代码,可以更加便于运行.其实是为了那些进不去github准备的~
- 探索 Python + HyperLPR 进行车牌识别
概要 HyperLRP是一个开源的.基于深度学习高性能中文车牌识别库,由北京智云视图科技有限公司开发,支持PHP.C/C++.Python语言,Windows/Mac/Linux/Android/IO ...
- 基于opencv的车牌识别系统
前言 学习了很长一段时间了,需要沉淀下,而最好的办法就是做一个东西来应用学习的东西,同时也是一个学习的过程. 概述 OpenCV的全称是:Open Source Computer Vision ...
- python+opencv实现车牌定位
写在前面 HIT大三上学期视听觉信号处理课程中视觉部分的实验三,经过和学长们实验的对比发现每一级实验要求都不一样,因此这里标明了是2019年秋季学期的视觉实验三. 由于时间紧张,代码没有进行任何优化, ...
随机推荐
- 关于android studio中使用class.forname()方法动态获取类实例报NO CLASS FOUND异常的几种处理方法
最近在做一个项目的时候需要用到反射来回调子类的方法,但是在反射过程中总是在class.forname()方法抛出NO CLASS FOUND异常,经过几部检查,问题解决,在此总结一下引起该问题的原因 ...
- 2-4 zookeeper配置文件介绍,运行zk
心跳机制就是超过一定的时间之后,那么这个从节点就会被抛弃. zookeeper需要存储的数据,比如说事务文件等等,它都会存到这个dataDir目录下. 如果是伪分布式的集群环境,那么它的端口肯定是要变 ...
- 猪羊——HTML解析
HTML标签和属性大全见:http://www.cnblogs.com/Mr-liyang/p/5797976.html CSS样式大全:http://www.cnblogs.com/Mr-liyan ...
- centos 安装 python flask 和python3安装flask
pip install Flask python3安装 pip3 install flask
- opencv3.2 编译安装说明
Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the ...
- CF702E Analysis of Pathes in Functional Graph
倍增练习题. 基环树上倍增一下维护维护最小值和权值和,注意循环的时候$j$这维作为状态要放在外层循环,平时在树上做的时候一个一个结点处理并不会错,因为之前访问的结点已经全部处理过了. 时间复杂度$O( ...
- Django框架 之 ORM查询操作详解
Django框架 之 ORM查询操作详解 浏览目录 一般操作 ForeignKey操作 ManyToManyField 聚合查询 分组查询 F查询和Q查询 事务 Django终端打印SQL语句 在Py ...
- java线程安全的元素
集合类: Vector Stack HashTable enumeration 字符串: StringBuffer
- img中 src 中文路径解决办法
最近有个项目场景如下:需要后台遍历图片.视频所在的文件夹,获取的到的路径传递到JSP页面,使用<img src="具体的路径">显示图片.遇到的问题:如果图片的路径.图 ...
- Python中list常用的10个基本方法----list的灰魔法
########################list 的常用的10个基本方法################################## list 类 列表# 1 列表的基本格式#2 可以 ...