我有一个名为locations.xml
的文件,其中包含图像文件名以及在相应图像上绘制矩形的位置。XML节点结构如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<tagset>
<image>
<imageName>ryoungt_05.08.2002/aPICT0034.JPG</imageName>
<resolution x="960" y="1280" />
<taggedRectangles>
<taggedRectangle x="196.0" y="901.0" width="111.0" height="67.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="116.0" y="896.0" width="59.0" height="69.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="442.0" y="794.0" width="424.0" height="67.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="212.0" y="793.0" width="200.0" height="66.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="99.0" y="560.0" width="302.0" height="76.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="107.0" y="791.0" width="84.0" height="66.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="512.0" y="682.0" width="366.0" height="74.0" offset="0.0" rotation="0.0" userName="admin" />
<taggedRectangle x="104.0" y="678.0" width="376.0" height="73.0" offset="0.0" rotation="0.0" userName="admin" />
</taggedRectangles>
</image>
我需要在
OpenCV
中打开此文件,并读取其中的内容。对于XML文件中的每个图像文件名,相应的图像将在窗口中打开,并在相应的图像上绘制矩形。基本上,我需要打开这些文件并查看矩形,以便将其与使用文本检测算法在同一图像上绘制的矩形进行匹配。但是,处理XML文件让我感到困惑。如果有任何帮助,将不胜感激。