Beispiel #1
0
    def handle(self, *args, **options):
        for anno in Annotation.objects.all():
            a = fix_transpose(json.loads(anno.anno)["shapes"][0]["geometry"])
            print "%s\t%g\t%g\t%g\t%g" %(anno.image.meta, a["x"], a["y"], a["width"], a["height"])
        #hours = options['hours'] + 24 * options['days']
        #check_and_import(hours, not options['run'], options['check'])

        pass
Beispiel #2
0
    def handle(self, *args, **options):
        for anno in Annotation.objects.all():
            a = fix_transpose(json.loads(anno.anno)["shapes"][0]["geometry"])
            print "%s\t%g\t%g\t%g\t%g" % (anno.image.meta, a["x"], a["y"],
                                          a["width"], a["height"])
        #hours = options['hours'] + 24 * options['days']
        #check_and_import(hours, not options['run'], options['check'])

        pass
Beispiel #3
0
 def handle(self, *args, **options):
     #hours = options['hours'] + 24 * options['days']
     #check_and_import(hours, not options['run'], options['check'])
     output = options['output'][0]
     all = {}
     if options['all']:
         for image in Image.objects.filter(viewed=True):
             all[image] = {"shapes": []}
             pass
     for anno in Annotation.objects.all():
         shapes = all.setdefault(
             anno.image, {"shapes": []})["shapes"].append(
                 fix_transpose(json.loads(anno.anno)["shapes"][0]))
         pass
     if os.path.exists(output):
         os.remove(output)
     pp = picpac.Writer(output, picpac.OVERWRITE)
     for image, anno in all.items():
         with open(image.path, 'rb') as f:
             buf = f.read()
         pp.append(0, buf, json.dumps(anno).encode('ascii'))
         print(anno)
     pass