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

html5网站动态效果折扣网站怎么做

html5网站动态效果,折扣网站怎么做,郑州模板建站代理,广西壮族自治区官网此代码的功能是标注信息验证#xff0c;将原图和YOLOv8标注文件#xff08;txt#xff09;放在同一个文件夹中#xff0c;作为输入文件夹 程序将标注的信息还原到原图中#xff0c;并将原图和标注后的图像一同保存#xff0c;以便查看 两个draw_labels函数#xff0c;分…此代码的功能是标注信息验证将原图和YOLOv8标注文件txt放在同一个文件夹中作为输入文件夹 程序将标注的信息还原到原图中并将原图和标注后的图像一同保存以便查看 两个draw_labels函数分别是将目标区域轮廓标出来或者颜色填充 import cv2 import numpy as np import osdef read_txt_labels(txt_file):从 txt 标注文件中读取标签:param txt_file: txt 标注文件路径:return: 标签列表with open(txt_file, r) as f:labels []for line in f.readlines():label_data line.strip().split( )class_id int(label_data[0])# 解析边界框坐标coordinates [float(x) for x in label_data[1:]]labels.append([class_id, coordinates])return labelsdef draw_labels(image, labels):在图像上绘制分割区域轮廓:param image: 图像:param labels: 标签列表for label in labels:class_id, coordinates label# 将坐标转换为整数并重新塑形为多边形points [(int(x * image.shape[1]), int(y * image.shape[0])) for x, y in zip(coordinates[::2], coordinates[1::2])]# 使用多边形绘制轮廓cv2.polylines(image, [np.array(points)], True, (0, 0, 255), 2) # 红色表示分割区域轮廓# def draw_labels(image, labels): # # 在图像上绘制分割区域 # :param image: 图像 # :param labels: 标签列表 # # for label in labels: # class_id, coordinates label # # 将坐标转换为整数并重新塑形为多边形 # points [(int(x * image.shape[1]), int(y * image.shape[0])) for x, y in zip(coordinates[::2], coordinates[1::2])] # # 使用多边形填充 # cv2.fillPoly(image, [np.array(points)], (0, 255, 0)) # 绿色表示分割区域def process_and_save_image(image_path, txt_path, output_folder):# 读取图像image cv2.imread(image_path)labels read_txt_labels(txt_path)# 复制原始图像以进行绘制image_with_labels image.copy()# 绘制分割区域draw_labels(image_with_labels, labels)# 创建一个新的图像左侧是原图右侧是带标注的图combined_image np.concatenate((image, image_with_labels), axis1)# 定义输出图像路径base_filename os.path.basename(image_path)output_image_path os.path.join(output_folder, base_filename)# 保存图像cv2.imwrite(output_image_path, combined_image)def main(input_folder, output_folder):# 确保输出文件夹存在if not os.path.exists(output_folder):os.makedirs(output_folder)# 获取输入文件夹中的所有图片文件image_files [f for f in os.listdir(input_folder) if f.lower().endswith((.png, .jpg, .jpeg))]for image_file in image_files:# 构建图像和标注文件的路径image_path os.path.join(input_folder, image_file)txt_file os.path.splitext(image_path)[0] .txt# 检查标注文件是否存在if os.path.exists(txt_file):process_and_save_image(image_path, txt_file, output_folder)else:print(f标注文件 {txt_file} 不存在跳过图像 {image_file})if __name__ __main__:input_folder_path D:\Desktop\images # 替换为实际的输入文件夹路径output_folder_path D:\Desktop\images_02 # 替换为实际的输出文件夹路径main(input_folder_path, output_folder_path)示例
http://www.pierceye.com/news/972877/

相关文章:

  • 网站建设唯地带泰安人才招聘网官方招聘
  • 备案域名一定要建好网站吗广州建企业网站
  • 移动网站建设商八爪鱼 导入 wordpress
  • 建设网站公司哪家性价比高怎么开网店找货源
  • 做图片素材的网站有哪些九宫格网站模板
  • 做网上水果网站的调查海外站推广
  • 苏州外贸公司网站建设流程图企业老板培训课程
  • 北京 做网站比较有名的网站开发html5技术
  • 优质校建设网站建行个人网上登录入口
  • 电话销售做网站打官司八里河网站建设项目建设可行性
  • 做电话销售需要的网站电商网站开发要求
  • 深圳住房和建设局网站网上预约网站和公众号的区别
  • 3g下订单的网站怎么做固定ip如何做网站服务器
  • 条友网seo做得好的企业网站
  • 西宁网站建设报价cu君博規范html5微信网站模板
  • vs做网站添加背景专业微网站建设公司
  • 懒人手机网站模板free wordpress theme
  • 网站内置多语言自建网站如何被百度收录
  • 罗湖网站-建设深圳信科网站建设天猫店
  • 集团制度建设网站网站开发哪好
  • 大数据与网站开发技术做公司网站用什么系统
  • 河南网站建设价格寿光网站建设定制
  • 潍坊 开发区网站建设青海省网络公司
  • 网页设计的网网页设计的网站1688免费货源
  • 哪个网站可以做鞋鉴定濮阳河南网站建设
  • 建站之星如何建网站公司网站百度地图
  • 帮人做ppt的网站网站建设规划设计方案
  • 电子工程师网站私人网站服务器免费
  • 北京网站制作排名系统开发必须遵守的原则有哪些
  • 东莞企业网站建设公司做网站开源框架