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

新疆网站建设一条龙服务seo技术软件

新疆网站建设一条龙服务,seo技术软件,网站备案注销怎么恢复,网站维护方法import cv2 as cv import os import numpy as np# 遍历文件夹函数 def getFileList(dir, Filelist, extNone):"""获取文件夹及其子文件夹中文件列表输入 dir:文件夹根目录输入 ext: 扩展名返回: 文件路径列表"""newDir d…

import cv2 as cv
import os
import numpy as np# 遍历文件夹函数
def getFileList(dir, Filelist, ext=None):"""获取文件夹及其子文件夹中文件列表输入 dir:文件夹根目录输入 ext: 扩展名返回: 文件路径列表"""newDir = dirif os.path.isfile(dir):if ext is None:Filelist.append(dir)else:if ext in dir[-3:]:Filelist.append(dir)elif os.path.isdir(dir):for s in os.listdir(dir):newDir = os.path.join(dir, s)getFileList(newDir, Filelist, ext)return Filelistdef mid(follow, mask):crossroads = FalsehalfWidth = follow.shape[1] // 2half = halfWidth  # 从下往上扫描赛道,最下端取图片中线为分割线for y in range(follow.shape[0] - 1, -1, -1):# V2改动:加入分割线左右各半张图片的宽度作为约束,减小邻近赛道的干扰if (mask[y][max(0, half - halfWidth):half] == np.zeros_like(mask[y][max(0, half - halfWidth):half])).all():  # 分割线左端无赛道left = max(0, half - halfWidth)  # 取图片左边界else:left = np.average(np.where(mask[y][0:half] == 255))  # 计算分割线左端平均位置if (mask[y][half:min(follow.shape[1], half + halfWidth)] == np.zeros_like(mask[y][half:min(follow.shape[1], half + halfWidth)])).all():  # 分割线右端无赛道right = min(follow.shape[1], half + halfWidth)  # 取图片右边界else:right = np.average(np.where(mask[y][half:follow.shape[1]] == 255)) + half  # 计算分割线右端平均位置mid = (left + right) // 2  # 计算拟合中点vibra = abs(mid - half)  # 振荡偏差# V3改动:检测到异常振荡则判定为十字路口,并保持直行if vibra > 30 and y < 479:crossroads = Truemid = int(mid)half = mid  # 递归,从下往上确定分割线follow[y, mid] = 255  # 画出拟合中线if y == 360:  # 设置指定提取中点的纵轴位置mid_output = midif crossroads:print("crossroads!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")mid_output = halfWidthcv.circle(follow, (mid_output, 360), 5, 255, -1)  # opencv为(x,y),画出指定提取中点error = follow.shape[1] // 2 - mid_output  # 计算图片中点与指定提取中点的误差return follow, error  # error为正数右转,为负数左转n = -1
# 存放图片的文件夹路径
path = "./phone"
imglist = getFileList(path, [])
for imgpath in imglist:n += 1if n < 0:continueimg = cv.imread(imgpath)img = cv.resize(img, (640, 480))# HSV阈值分割img_hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)mask = cv.inRange(img_hsv, np.array([43, 60, 90]), np.array([62, 255, 255]))follow = mask.copy()follow, error = mid(follow, mask)print(n, f"error:{error}")cv.imshow("img", img)cv.imshow("mask", mask)cv.imshow("follow", follow)cv.waitKey(0)cv.destroyAllWindows()

http://www.ds6.com.cn/news/109453.html

相关文章:

  • 求个网站谢谢啦百度网盘人工客服
  • 充值网站怎么做南宁seo多少钱报价
  • 阿里云网站建设认证答案百度排名工具
  • 做网站如何把支付宝微信吧最近最新的新闻
  • 如何推广自己的公司杭州优化seo
  • 淄博周村网站建设方案推广之家官网
  • 可以免费观看电影的网站免费发广告的软件
  • 网站备案名称规则厦门seo网络推广
  • 四川网站建设设计网络推广学校
  • 做外卖骑手用哪个网站通州区网站快速排名方案
  • 哪个网站可以做名片百度seo一本通
  • 公司的网站建设 交给谁做更好些百度网盘资源搜索引擎
  • visio画网站开发类图巢湖网站制作
  • 做网站设计需要学会哪些如何百度推广
  • 网站建设公司gzzhixun如何建立一个网站
  • 微网站建设申请怎么做一个网站页面
  • 学做ps的网站有哪些东莞seo优化案例
  • 慧聪网做网站客服深圳市seo网络推广哪家好
  • 网站访问量js网络营销的作用
  • 吉林做网站公司怎么建立自己的企业网站
  • 做视频网站带宽不够怎么办全国疫情高峰时间表最新
  • 有没有做定制衣服的网站宣传方式有哪些
  • html在线编写网站怎样做seo搜索引擎优化
  • 沂seo网站推广全达seo
  • 免费建站好不好免费crm系统手机版
  • 个人简历模板免费下载word文档网站seo专员
  • 陕西手机网站建设游戏推广代理加盟
  • 有名设计网站yandex搜索入口
  • 做钢化膜网站杭州今天查出多少阳性
  • html 网站建设中模板微信最好用的营销软件