Ejemplo n.º 1
0
    def write_xml(self):
        imgFolderName = ustr(self.image_path).split('/')[-2]
        print imgFolderName
        #imgFileName = str(self.image_path).split('/')[-1]
        imgFileNameWithoutExt = ustr(self.image_path).split('.')[0]
        print imgFileNameWithoutExt

        image = QtGui.QImage()
        image.load(ustr(self.image_path))
        imageShape = [
            image.height(),
            image.width(), 1 if image.isGrayscale() else 3
        ]
        writer = PascalVocWriter(imgFolderName,
                                 imgFileNameWithoutExt,
                                 imageShape,
                                 localImgPath=ustr(self.image_path))
        #writer.verified = self.verified
        item = {}
        item['name'] = ''
        item['flood1name'] = imgFileNameWithoutExt + '_index.bmp'
        item['flood2name'] = imgFileNameWithoutExt + '_category.bmp'
        writer.addObject(item['name'], item['flood1name'], item['flood2name'])

        writer.save()
        return