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

wordpress网站模板怎么用如何开发自己的小程序

wordpress网站模板怎么用,如何开发自己的小程序,淘宝客手机网站,惠安建设局网站语义分割的标签(目标处为255,其余处为0) 实例分割的标签(yolo.txt),描述边界的多边形顶点的归一化位置 绘制在原图类似蓝色的边框所示。 废话不多说,直接贴代码; import os import cv2 imp…

语义分割的标签(目标处为255,其余处为0)
在这里插入图片描述
实例分割的标签(yolo.txt),描述边界的多边形顶点的归一化位置
在这里插入图片描述
绘制在原图类似蓝色的边框所示。
在这里插入图片描述

废话不多说,直接贴代码;

import os
import cv2
import numpy as np
import shutildef img2label(imgPath, labelPath, imgbjPath, seletName):# 检查labelPath文件夹是否存在if not os.path.exists(labelPath):os.makedirs(labelPath)if not os.path.exists(imgbjPath):os.makedirs(imgbjPath)imgList = os.listdir(imgPath)for imgName in imgList:# 筛选if imgName.split('_')[0] != seletName and seletName != '':continueprint(imgName)img = cv2.imread(imgPath + imgName, cv2.IMREAD_COLOR)h, w, _ = img.shape# print(h, w)GrayImage=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) #图片灰度化处理ret, binary = cv2.threshold(GrayImage,40,255,cv2.THRESH_BINARY) #图片二值化,灰度值大于40赋值255,反之0# ret, binary = cv2.threshold(binary, 80, 255, cv2.THRESH_BINARY_INV)    # (黑白二值反转)cv2.imwrite(r'denoisedfz.png', binary) #保存图片# 腐蚀# kernel = np.ones((3,3),np.uint8) # binary = cv2.erode(binary,kernel,iterations = 3)thresholdL = h/100 * w/100   #设定阈值thresholdH = h/1 * w/1   #设定阈值#cv2.fingContours寻找图片轮廓信息"""提取二值化后图片中的轮廓信息 ,返回值contours存储的即是图片中的轮廓信息,是一个向量,内每个元素保存了一组由连续的Point点构成的点的集合的向量,每一组Point点集就是一个轮廓,有多少轮廓,向量contours就有多少元素"""contours,hierarch=cv2.findContours(binary,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_TC89_L1)contoursNorm = []objs= []# print(contours)for i in range(len(contours)):area = cv2.contourArea(contours[i]) #计算轮廓所占面积# print(area)if area > thresholdL and area < thresholdH:obj = ['0']for point in contours[i]:obj.append(str(point[0][0] * 1.0 / w)) # 获取xobj.append(str(point[0][1] * 1.0 / h)) # 获取ycontoursNorm.append(contours[i])objs.append(obj)# print(objs[10])# 查看效果cv2.drawContours(img, contoursNorm, -1,(255,0,0),2)cv2.imwrite(imgbjPath+imgName, img) #保存图片if len(objs) == 0:print('不保存标签,跳过!')continue# 写入txtrealName = imgName.split('-l')[0]f=open(labelPath + realName + '.txt',"w")for obj in objs:f.writelines(' '.join(obj))f.writelines('\n')f.close()# break# oridata 保存着原图像
# maskdata 保存着标签图像
# lab 保存这yolo格式的标签文件
# bj 保存着标记好边界的图像def OrganizeImages(path):imgs = os.listdir(path)for im in imgs:imPath = os.path.join(path, im)if im.split('.')[-1] == 'jpg':# 原图像# 移动到oridatasource_path = imPathdestination_path = 'data\\oridata\\' + imshutil.copy(source_path, destination_path)if im.split('.')[-1] == 'png':# mask label# 移动到maskdatasource_path = imPathdestination_path = 'data\\maskdata\\' + imshutil.copy(source_path, destination_path)if __name__ == '__main__':img2label(imgPath='data\\maskdata\\',  # maskdata 保存着标签图像labelPath='data\\lab\\',     # lab 保存这yolo格式的标签文件imgbjPath = 'data\\bj\\',    # bj 保存着标记好边界的图像seletName='')
http://www.hrbkazy.com/news/45738.html

相关文章:

  • 公司做网站好吗百度推销广告一年多少钱
  • 微信小程序制作多少钱一个什么是seo是什么意思
  • 上饶做网站的网页推广怎么收取费用
  • 主页网站怎么建设91关键词
  • 免费网站建设软件大全线上推广产品
  • 北京东城区做网站的公司安卓优化
  • 怎样买空间做网站深圳设计公司
  • 上海网页设计培训网seo哪里可以学
  • 武汉网站策划如何在百度发广告推广
  • 电影网站加盟可以做么互联网广告平台有哪些
  • wordpress个人云盘seo 优化思路
  • 襄阳政府网站建设网址seo分析
  • 苍南网站建设郑州网络推广效果
  • 机械技术支持东莞网站建设白帽优化关键词排名seo
  • 税务 网站建设 重视google框架三件套
  • 绵阳东原建设工程有限公司网站怎么创建网址
  • 建手机wap网站大概多少钱北京网站外包
  • 青岛哪家做网站好广西网站建设
  • jsp mysql 开发网站开发百度关键词热度
  • 优化电池充电是关闭还是打开好杭州seo专员
  • 网站需要每个城市做推广吗aso推广方案
  • 北京朝阳网站建设公司南宁百度seo推广
  • 济宁百姓网免费发布信息网如何优化关键词
  • 展厅施工公司长春百度seo排名
  • 天津高端网站建设自己开发网站
  • 做怎么样的网站好seo基础知识培训
  • 网站建设外文版政策文件推广论坛有哪些
  • 做网站卖产品制造企业网站建设
  • 网站建设实践报告绪论如何提交百度收录
  • 怎么搭建自己的网站百度收录提交入口网址