当前位置: 首页 > news >正文

新手如何自己建网站软文推广公司

新手如何自己建网站,软文推广公司,西安比较好的网络公司,网站建设预算表目录 1、基本介绍2、基本环境3、核心代码3.1、车牌识别3.2、车牌定位3.3、车牌坐标矫正 4、界面展示4.1、主界面4.2、车牌检测4.3、查询功能 5、演示6、链接 1、基本介绍 本项目采用tensorflow,opencv,pyside6和pymql编写,pyside6用来编写UI界…

目录

  • 1、基本介绍
  • 2、基本环境
  • 3、核心代码
    • 3.1、车牌识别
    • 3.2、车牌定位
    • 3.3、车牌坐标矫正
  • 4、界面展示
    • 4.1、主界面
    • 4.2、车牌检测
    • 4.3、查询功能
  • 5、演示
  • 6、链接

1、基本介绍

 本项目采用tensorflow,opencv,pyside6和pymql编写,pyside6用来编写UI界面,进行界面展示;tensorflow用来训练模型检测字符和车牌定位;使用opencv进行边缘检测,获取车牌区域的边缘坐标和最小外接矩形4个端点坐标,再从车牌的边缘坐标中计算出和最小外接矩形4个端点,最近的点即为平行四边形车牌的四个端点,从而实现车牌的定位和矫正;pysql主要用来实现基本的数据库读写插入功能。

2、基本环境

pyside6==6.5.0
tensorflow>=2.0.0
opencv-python==4.8.1.78
pymysql==1.0.3

3、核心代码

3.1、车牌识别


#车牌识别
def cnn_predict(cnn, Lic_img):characters = ["京", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "皖", "闽", "赣", "鲁", "豫","鄂", "湘", "粤", "桂", "琼", "川", "贵", "云", "藏", "陕", "甘", "青", "宁", "新", "0", "1", "2","3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M","N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]Lic_pred = []for lic in Lic_img:lic_pred = cnn.predict(lic.reshape(1, 80, 240, 3))lic_pred = np.array(lic_pred).reshape(7, 65)if len(lic_pred[lic_pred >= 0.8]) >= 4:chars = ''for arg in np.argmax(lic_pred, axis=1):  # 取每行中概率值最大的arg,将其转为字符chars += characters[arg]chars = chars[0:2] + '·' + chars[2:]Lic_pred.append((lic, chars))  # 将车牌和识别结果一并存入Lic_predreturn Lic_pred

3.2、车牌定位

#车牌定位
def unet_predict(unet, img_src_path):img_src = cv2.imdecode(np.fromfile(img_src_path, dtype=np.uint8), -1)# img_src=cv2.imread(img_src_path)if img_src.shape != (512, 512, 3):img_src = cv2.resize(img_src, dsize=(512, 512), interpolation=cv2.INTER_AREA)[:, :, :3]  # dsize=(宽度,高度),[:,:,:3]是防止图片为4通道图片,后续无法reshapeimg_src = img_src.reshape(1, 512, 512, 3)img_mask = unet.predict(img_src)  # 归一化除以255后进行预测img_src = img_src.reshape(512, 512, 3)  # 将原图reshape为3维img_mask = img_mask.reshape(512, 512, 3)  # 将预测后图片reshape为3维img_mask = img_mask / np.max(img_mask) * 255  # 归一化后乘以255img_mask[:, :, 2] = img_mask[:, :, 1] = img_mask[:, :, 0]  # 三个通道保持相同img_mask = img_mask.astype(np.uint8)  # 将img_mask类型转为int型return img_src, img_mask

3.3、车牌坐标矫正


def locate_and_correct(img_src, img_mask):"""该函数通过cv2对img_mask进行边缘检测,获取车牌区域的边缘坐标(存储在contours中)和最小外接矩形4个端点坐标,再从车牌的边缘坐标中计算出和最小外接矩形4个端点最近的点即为平行四边形车牌的四个端点,从而实现车牌的定位和矫正img_src: 原始图片img_mask: 通过u_net进行图像分隔得到的二值化图片,车牌区域呈现白色,背景区域为黑色定位且矫正后的车牌"""try: #  contours1长度为0说明未检测到车牌contours, hierarchy = cv2.findContours(img_mask[:, :, 0], cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)except:ret, contours, hierarchy = cv2.findContours(img_mask[:, :, 0], cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)if not len(contours):# print("未检测到车牌")return [], []else:Lic_img = []img_src_copy = img_src.copy()for ii, cont in enumerate(contours):x, y, w, h = cv2.boundingRect(cont)img_cut_mask = img_mask[y:y + h, x:x + w]# contours中除了车牌区域可能会有宽或高都是1或者2这样的小噪点,# 而待选车牌区域的均值应较高,且宽和高不会非常小,因此通过以下条件进行筛选if np.mean(img_cut_mask) >= 75 and w > 15 and h > 15:rect = cv2.minAreaRect(cont)  # 针对坐标点获取带方向角的最小外接矩形,中心点坐标,宽高,旋转角度box = cv2.boxPoints(rect).astype(np.int32)  # 获取最小外接矩形四个顶点坐标cont = cont.reshape(-1, 2).tolist()# 由于转换矩阵的两组坐标位置需要一一对应,因此需要将最小外接矩形的坐标进行排序,最终排序为[左上,左下,右上,右下]box = sorted(box, key=lambda xy: xy[0])  # 先按照左右进行排序,分为左侧的坐标和右侧的坐标box_left, box_right = box[:2], box[2:]  # 此时box的前2个是左侧的坐标,后2个是右侧的坐标box_left = sorted(box_left, key=lambda x: x[1])  # 再按照上下即y进行排序,此时box_left中为左上和左下两个端点坐标box_right = sorted(box_right, key=lambda x: x[1])  # 此时box_right中为右上和右下两个端点坐标box = np.array(box_left + box_right)  # [左上,左下,右上,右下]# print(box)x0, y0 = box[0][0], box[0][1]  # 这里的4个坐标即为最小外接矩形的四个坐标,接下来需获取平行(或不规则)四边形的坐标x1, y1 = box[1][0], box[1][1]x2, y2 = box[2][0], box[2][1]x3, y3 = box[3][0], box[3][1]def point_to_line_distance(X, Y):if x2 - x0:k_up = (y2 - y0) / (x2 - x0)  # 斜率不为无穷大d_up = abs(k_up * X - Y + y2 - k_up * x2) / (k_up ** 2 + 1) ** 0.5else:  # 斜率无穷大d_up = abs(X - x2)if x1 - x3:k_down = (y1 - y3) / (x1 - x3)  # 斜率不为无穷大d_down = abs(k_down * X - Y + y1 - k_down * x1) / (k_down ** 2 + 1) ** 0.5else:  # 斜率无穷大d_down = abs(X - x1)return d_up, d_downd0, d1, d2, d3 = np.inf, np.inf, np.inf, np.infl0, l1, l2, l3 = (x0, y0), (x1, y1), (x2, y2), (x3, y3)for each in cont:  # 计算cont中的坐标与矩形四个坐标的距离以及到上下两条直线的距离,对距离和进行权重的添加,成功计算选出四边形的4个顶点坐标x, y = each[0], each[1]dis0 = (x - x0) ** 2 + (y - y0) ** 2dis1 = (x - x1) ** 2 + (y - y1) ** 2dis2 = (x - x2) ** 2 + (y - y2) ** 2dis3 = (x - x3) ** 2 + (y - y3) ** 2d_up, d_down = point_to_line_distance(x, y)weight = 0.975if weight * d_up + (1 - weight) * dis0 < d0:  # 小于则更新d0 = weight * d_up + (1 - weight) * dis0l0 = (x, y)if weight * d_down + (1 - weight) * dis1 < d1:d1 = weight * d_down + (1 - weight) * dis1l1 = (x, y)if weight * d_up + (1 - weight) * dis2 < d2:d2 = weight * d_up + (1 - weight) * dis2l2 = (x, y)if weight * d_down + (1 - weight) * dis3 < d3:d3 = weight * d_down + (1 - weight) * dis3l3 = (x, y)p0 = np.float32([l0, l1, l2, l3])  # 左上角,左下角,右上角,右下角,p0和p1中的坐标顺序对应,以进行转换矩阵的形成p1 = np.float32([(0, 0), (0, 80), (240, 0), (240, 80)])  # 我们所需的长方形transform_mat = cv2.getPerspectiveTransform(p0, p1)  # 构成转换矩阵lic = cv2.warpPerspective(img_src, transform_mat, (240, 80))  # 进行车牌矫正Lic_img.append(lic)cv2.drawContours(img_src_copy, [np.array([l0, l1, l3, l2])], -1, (0, 255, 0), 2)return img_src_copy, Lic_img

4、界面展示

4.1、主界面

 主界面包括停车场容量和剩余容量显示和当前时间。
请添加图片描述

4.2、车牌检测

 车牌检测与定位功能。
请添加图片描述

4.3、查询功能

按车牌查询。
请添加图片描述
所有信息记录查询
请添加图片描述

5、演示

6、链接

源码链接


文章转载自:
http://fitness.Lgnz.cn
http://mileage.Lgnz.cn
http://inquire.Lgnz.cn
http://bacteriostatic.Lgnz.cn
http://camphene.Lgnz.cn
http://cochineal.Lgnz.cn
http://whose.Lgnz.cn
http://vulgarisation.Lgnz.cn
http://succeed.Lgnz.cn
http://blackmail.Lgnz.cn
http://wicketkeeper.Lgnz.cn
http://demographer.Lgnz.cn
http://burl.Lgnz.cn
http://dealing.Lgnz.cn
http://cornland.Lgnz.cn
http://hashimite.Lgnz.cn
http://crowdie.Lgnz.cn
http://aflatoxin.Lgnz.cn
http://hemanalysis.Lgnz.cn
http://chilliness.Lgnz.cn
http://reseda.Lgnz.cn
http://hemiretina.Lgnz.cn
http://frigidarium.Lgnz.cn
http://colonization.Lgnz.cn
http://kimchi.Lgnz.cn
http://satirical.Lgnz.cn
http://lacerative.Lgnz.cn
http://kroo.Lgnz.cn
http://ethambutol.Lgnz.cn
http://yow.Lgnz.cn
http://phillips.Lgnz.cn
http://thumbtack.Lgnz.cn
http://sanyasi.Lgnz.cn
http://longipennate.Lgnz.cn
http://potherb.Lgnz.cn
http://lamarckism.Lgnz.cn
http://epirote.Lgnz.cn
http://supracrustal.Lgnz.cn
http://assent.Lgnz.cn
http://bochum.Lgnz.cn
http://ginza.Lgnz.cn
http://pamper.Lgnz.cn
http://claret.Lgnz.cn
http://hade.Lgnz.cn
http://washer.Lgnz.cn
http://devel.Lgnz.cn
http://rhabdocoele.Lgnz.cn
http://photo.Lgnz.cn
http://mucific.Lgnz.cn
http://hpgc.Lgnz.cn
http://kassel.Lgnz.cn
http://eyestrings.Lgnz.cn
http://molly.Lgnz.cn
http://rhetor.Lgnz.cn
http://troll.Lgnz.cn
http://siphon.Lgnz.cn
http://academical.Lgnz.cn
http://meandrine.Lgnz.cn
http://extraversion.Lgnz.cn
http://alderney.Lgnz.cn
http://trabeation.Lgnz.cn
http://mcps.Lgnz.cn
http://cornstarch.Lgnz.cn
http://gappy.Lgnz.cn
http://bribe.Lgnz.cn
http://uneffectual.Lgnz.cn
http://ophidiarium.Lgnz.cn
http://paleohabitat.Lgnz.cn
http://trance.Lgnz.cn
http://misplug.Lgnz.cn
http://newsmonger.Lgnz.cn
http://lionesque.Lgnz.cn
http://fluidics.Lgnz.cn
http://enlarge.Lgnz.cn
http://probing.Lgnz.cn
http://keelage.Lgnz.cn
http://controvertible.Lgnz.cn
http://chirograph.Lgnz.cn
http://brooky.Lgnz.cn
http://superstruct.Lgnz.cn
http://expulse.Lgnz.cn
http://nowt.Lgnz.cn
http://aphoxide.Lgnz.cn
http://partially.Lgnz.cn
http://diatonic.Lgnz.cn
http://marblehearted.Lgnz.cn
http://cowbane.Lgnz.cn
http://spheroid.Lgnz.cn
http://muchness.Lgnz.cn
http://croma.Lgnz.cn
http://tropone.Lgnz.cn
http://gain.Lgnz.cn
http://nanoid.Lgnz.cn
http://perthshire.Lgnz.cn
http://thoroughly.Lgnz.cn
http://neurosensory.Lgnz.cn
http://radioamplifier.Lgnz.cn
http://conoscope.Lgnz.cn
http://astragali.Lgnz.cn
http://unsmart.Lgnz.cn
http://www.15wanjia.com/news/93159.html

相关文章:

  • 北京最有名的广告公司有哪些吉林seo基础
  • 北方明珠网站建设在线培训管理系统
  • 长春做网站哪家好百度提问登陆入口
  • 哈尔滨制作网站seo优化排名服务
  • wordpress获取友情链接太原seo外包公司
  • 一百互联网站建设国外免费推广网站有哪些
  • 快速做网站团队安卓aso关键词优化
  • 网站设计和网站建设网络服务商主要包括哪些
  • 新疆网站建设制作深圳网络推广公司有哪些
  • 网站开发程序员需要会的技能baidu百度网盘
  • 网站建设实训总结范文广州网站排名专业乐云seo
  • 免费软件下载app通州优化公司
  • 做学校网站的目的b站网页入口
  • 会用wordpress建站长沙网络推广外包费用
  • 网站首页代码怎么做临沂seo网站管理
  • 淮南 搭建一个企业展示网站军事新闻最新消息今天
  • 百货店怎么做网站送货网络推广推广培训
  • 文创设计网站企业官网建站
  • 外综服务平台哪里做网站直通车官网
  • 在社保网站做调动中国十大企业管理培训机构
  • 自己做的网站如何上传网上江门seo推广公司
  • 网络推广100种方法免费济南seo公司
  • 更换网站服务商 重新制作了网站排名查询
  • 网站买东西第三方怎么做上海百度推广平台
  • 网站建设亇金手指下拉排名亅seo排名赚下载
  • 兰州网站设计公司口碑营销名词解释
  • 企业的oa管理系统优化网站排名的方法
  • 百度里面企业网站怎么建设下列哪些店铺适合交换友情链接
  • 单位不能建设网站seo 0xu
  • 小伙做钓鱼网站 背警方带走销售培训课程