vuforiajs
Node.js client for the Vuforia Web Services API (VWS API) and the Vuforia Web Query API (VWQ API).
usage
var vuforia = require('vuforia-api');
var client = vuforia.client({
'serverAccessKey': 'your server access key',
'serverSecretKey': 'your server secret key',
'clientAccessKey': 'your client access key',
'clientSecretKey': 'your client secret key'
});
var util = vuforia.util();
create a new target
var target = {
'name': 'my target',
'width': 32.0,
'image': util.encodeFileBase64(__dirname + '/someImage.png'),
'active_flag': true,
'application_metadata': util.encodeBase64('some metadata about your image')
};
add target to cloud database
client.addTarget(target, function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
list all targets within cloud database
client.listTargets(function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
retrieve a target from cloud database
client.retrieveTarget('00550e84e29b41d4a71644665555678', function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
update a target
var update = {
'active_flag' : true,
'application_metadata' : util.encodeBase64('Some metadata about your image')
};
client.updateTarget('00550e84e29b41d4a71644665555678', update, function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
delete a target
client.deleteTarget('00550e84e29b41d4a71644665555678', function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
search cloud database for images that can be considered duplicates
client.checkForDuplicateTargets('00550e84e29b41d4a71644665555678', function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});
Perform an Image Recognition Query
var filename = __dirname + '/test.jpg';
var max_num_results = 5;
client.cloudRecoQuery(fs.readFileSync(filename, 'binary'), max_num_results, function (error, result) {
if (error) {
console.error(result);
} else {
console.log(result);
}
});