Reading XML file in openCV



I have an .xml file with the following contents:



<annotation>
<filename>action0005.jpg</filename>
<originalfile>26467307_0b0731a09b.jpg</originalfile>
<folder>Willow-actions</folder>
<source>
<annotation>Willow-actions</annotation>
<database>Willow-actions</database>
<image>flickr</image>
<flickrid>26467307</flickrid>
</source>
<segmented>0</segmented>
<size>
<width>400</width>
<height>266</height>
<depth>3</depth>
</size>
<object>
<name>person</name>
<bndbox>
<xmin>49</xmin>
<ymin>3</ymin>
<xmax>272</xmax>
<ymax>266</ymax>
</bndbox>
<pose>Frontal</pose>
<difficult>0</difficult>
<truncated>1</truncated>
<occluded>1</occluded>
</object>
</annotation>


My question is, how do i read and store only the xmin, ymin, xmax and ymax values in the < bndbox > < / bndbox > ? From the OpenCV documentation, probably i have to use the FileNodeIterator ? Or is there a simple way to do this ?


No comments:

Post a Comment