I'm currently working on an augmented reality app using Django and the Vuforia SDK. Vuforia provides an API to manage target images on the Vuforia Clouddatabase.

I stumbled across a python script to communicate with Vuforias Rest-API: https://github.com/dadoeyad/python-vuforia

The functions fetch data from the Database work nicely. But I can't figure out how to use the function to add data to the Database.

import augmented.vuforia

upload = vuforia.Vuforia()
data = '{"name":"tarmac","width":"265.0","image":"/9j/4AAQSkZJR..."}'
upload.add_target(data)

This gives me an error: Bad Http Request

Is someone smart out there who gets how the data should be formatted?

The docs also seem to have typos: https://developer.vuforia.com/resources/dev-guide/adding-target-cloud-database-api

有帮助吗?

解决方案

In the library there is an example of how to add a target.

v = Vuforia(server_access, server_secret)
image_file = open('PATH_TO_IMAGE_FILE')
image = base64.b64encode(image_file.read())
meta = "this is the metadata"
metadata = base64.b64encode(meta)
print v.add_target({"name": "zxczxc", "width": "550", "image": image, "application_metadata": metadata, "active_flag": 1})
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top