本文主要是介绍voc边框坐标旋转变换,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
import os
import xml.etree.ElementTree as ET
import cv2
import numpy as np
from matplotlib import pyplot as plt
ann=os.listdir('./Annotations')for _ in ann:path=os.path.join('./Annotations',_)tree=ET.parse(path)root=tree.getroot()image_name=root.find('filename').textimage_path=os.path.join('./JPEGImages',image_name)image=cv2.imread(image_path)rows,cols,_=image.shapeobj=root.find('object')xmlbox = obj.find('bndbox') # 读取标注信息 [xmin,ymin,xmax,yamx]b1 = (int(float(xmlbox.find('xmin').text)), int(float(xmlbox.find('ymin').text)),int(float(xmlbox.find('xmax').text)), int(float(xmlbox.find('ymax').text)))center=[cols/2, rows/2]for _ in [0,90,180,270]:# image1=np.rot90(image,_).copy()M = cv2.getRotationMatrix2D((cols/2, rows/2), _, 1
这篇关于voc边框坐标旋转变换的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!