@google-cloud/vision
Advanced tools
Comparing version 0.6.1 to 0.6.2
{ | ||
"name": "@google-cloud/vision", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"author": "Google Inc.", | ||
@@ -53,7 +53,7 @@ "description": "Google Cloud Vision Client Library for Node.js", | ||
"dependencies": { | ||
"@google-cloud/common": "^0.11.0", | ||
"@google-cloud/common": "^0.8.0", | ||
"arrify": "^1.0.0", | ||
"async": "^2.0.1", | ||
"extend": "^3.0.0", | ||
"google-gax": "^0.10.0", | ||
"google-gax": "^0.9.1", | ||
"google-proto-files": "^0.8.0", | ||
@@ -68,3 +68,3 @@ "is": "^3.0.1", | ||
"@google-cloud/storage": "*", | ||
"deep-strict-equal": "^0.2.0", | ||
"deep-strict-equal": "^0.1.0", | ||
"mocha": "^3.0.1", | ||
@@ -75,3 +75,3 @@ "multiline": "^1.0.2", | ||
"proxyquire": "^1.7.10", | ||
"tmp": "^0.0.31" | ||
"tmp": "0.0.27" | ||
}, | ||
@@ -78,0 +78,0 @@ "scripts": { |
@@ -1,4 +0,6 @@ | ||
# @google-cloud/vision ([Alpha][versioning]) | ||
# @google-cloud/vision | ||
> Google Cloud Vision Client Library for Node.js | ||
> **This is a Beta release of Google Cloud Vision.** This feature is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes. | ||
*Looking for more Google APIs than just Vision? You might want to check out [`google-cloud`][google-cloud].* | ||
@@ -125,8 +127,14 @@ | ||
### On Google Cloud Platform | ||
### On Google Compute Engine | ||
If you are running this client on Google Cloud Platform, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access. | ||
If you are running this client on Google Compute Engine, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access. | ||
``` js | ||
var vision = require('@google-cloud/vision')(); | ||
// Authenticating on a global basis. | ||
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' | ||
var vision = require('@google-cloud/vision')({ | ||
projectId: projectId | ||
}); | ||
// ...you're good to go! | ||
@@ -137,3 +145,3 @@ ``` | ||
If you are not running this client on Google Cloud Platform, you need a Google Developers service account. To create a service account: | ||
If you are not running this client on Google Compute Engine, you need a Google Developers service account. To create a service account: | ||
@@ -165,3 +173,2 @@ 1. Visit the [Google Developers Console][dev-console]. | ||
[versioning]: https://github.com/GoogleCloudPlatform/google-cloud-node#versioning | ||
[google-cloud]: https://github.com/GoogleCloudPlatform/google-cloud-node/ | ||
@@ -168,0 +175,0 @@ [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using |
@@ -42,2 +42,8 @@ /*! | ||
/** | ||
* <p class="notice"> | ||
* **This is a Beta release of Google Cloud Vision.** This API is not covered | ||
* by any SLA or deprecation policy and may be subject to backward- | ||
* incompatible changes. | ||
* </p> | ||
* | ||
* The [Cloud Vision API](https://cloud.google.com/vision/docs) allows easy | ||
@@ -832,9 +838,9 @@ * integration of vision detection features, including image labeling, face and | ||
* // confidence: 56.748849, | ||
* // anger: false, | ||
* // blurred: false, | ||
* // headwear: false, | ||
* // joy: false, | ||
* // sorrow: false, | ||
* // surprise: false, | ||
* // underExposed: false | ||
* // blurry: false, | ||
* // dark: false, | ||
* // happy: false, | ||
* // hat: false, | ||
* // mad: false, | ||
* // sad: false, | ||
* // surprised: false | ||
* // } | ||
@@ -1343,2 +1349,32 @@ * // ] | ||
/** | ||
* Convert an object with "likelihood" values to a boolean-representation, based | ||
* on the lowest likelihood provided. | ||
* | ||
* @private | ||
* | ||
* @example | ||
* Vision.convertToBoolean_(Vision.likelihood.VERY_LIKELY, { | ||
* blurry: 'POSSIBLE' | ||
* }); | ||
* // { blurry: false } | ||
* | ||
* Vision.convertToBoolean_(Vision.likelihood.UNLIKELY, { | ||
* blurry: 'POSSIBLE' | ||
* }); | ||
* // { blurry: true } | ||
*/ | ||
Vision.convertToBoolean_ = function(baseLikelihood, object) { | ||
var convertedObject = {}; | ||
for (var prop in object) { | ||
if (object.hasOwnProperty(prop)) { | ||
var value = Vision.likelihood[object[prop]]; | ||
convertedObject[prop] = value >= baseLikelihood; | ||
} | ||
} | ||
return convertedObject; | ||
}; | ||
/** | ||
* Determine the type of image the user is asking to be annotated. If a | ||
@@ -1556,13 +1592,12 @@ * {module:storage/file}, convert to its "gs://{bucket}/{file}" URL. If a remote | ||
// Remove the `Likelihood` part from a property name. | ||
// input: "joyLikelihood", output: "joy" | ||
for (var prop in faceAnnotation) { | ||
if (prop.indexOf('Likelihood') > -1) { | ||
var shortenedProp = prop.replace('Likelihood', ''); | ||
extend(formattedFaceAnnotation, Vision.convertToBoolean_(LIKELY, { | ||
blurry: faceAnnotation.blurredLikelihood, | ||
dark: faceAnnotation.underExposedLikelihood, | ||
happy: faceAnnotation.joyLikelihood, | ||
hat: faceAnnotation.headwearLikelihood, | ||
mad: faceAnnotation.angerLikelihood, | ||
sad: faceAnnotation.sorrowLikelihood, | ||
surprised: faceAnnotation.surpriseLikelihood | ||
})); | ||
formattedFaceAnnotation[shortenedProp] = | ||
Vision.gteLikelihood_(LIKELY, faceAnnotation[prop]); | ||
} | ||
} | ||
return formattedFaceAnnotation; | ||
@@ -1616,7 +1651,3 @@ }; | ||
if (!options.verbose) { | ||
for (var prop in ssAnnotation) { | ||
var value = ssAnnotation[prop]; | ||
ssAnnotation[prop] = Vision.gteLikelihood_(LIKELY, value); | ||
} | ||
return ssAnnotation; | ||
return Vision.convertToBoolean_(LIKELY, ssAnnotation); | ||
} | ||
@@ -1627,19 +1658,2 @@ | ||
/** | ||
* Convert a "likelihood" value to a boolean representation, based on the lowest | ||
* likelihood provided. | ||
* | ||
* @private | ||
* | ||
* @example | ||
* Vision.gteLikelihood_(Vision.likelihood.VERY_LIKELY, 'POSSIBLE'); | ||
* // false | ||
* | ||
* Vision.gteLikelihood_(Vision.likelihood.UNLIKELY, 'POSSIBLE'); | ||
* // true | ||
*/ | ||
Vision.gteLikelihood_ = function(baseLikelihood, likelihood) { | ||
return Vision.likelihood[likelihood] >= baseLikelihood; | ||
}; | ||
/*! Developer Documentation | ||
@@ -1646,0 +1660,0 @@ * |
@@ -18,3 +18,3 @@ /*! | ||
var visionClient = require('./image_annotator_client'); | ||
var visionApi = require('./image_annotator_api'); | ||
var extend = require('extend'); | ||
@@ -28,7 +28,7 @@ var gax = require('google-gax'); | ||
var gaxGrpc = gax.grpc(options); | ||
return visionClient(gaxGrpc); | ||
return visionApi(gaxGrpc); | ||
} | ||
v1.SERVICE_ADDRESS = visionClient.SERVICE_ADDRESS; | ||
v1.ALL_SCOPES = visionClient.ALL_SCOPES; | ||
v1.SERVICE_ADDRESS = visionApi.SERVICE_ADDRESS; | ||
v1.ALL_SCOPES = visionApi.ALL_SCOPES; | ||
module.exports = v1; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72335
1763
176
+ Added@google-cloud/common@0.8.1(transitive)
+ Addedarguejs@0.2.3(transitive)
+ Addedasync@1.4.2(transitive)
+ Addedbase64url@0.0.61.0.6(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcamelcase-keys@1.0.0(transitive)
+ Addedconcat-stream@1.4.11(transitive)
+ Addedform-data@1.0.1(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedgoogle-auth-library@0.9.10(transitive)
+ Addedgoogle-auto-auth@0.2.4(transitive)
+ Addedgoogle-gax@0.9.1(transitive)
+ Addedgrpc@1.0.1(transitive)
+ Addedindent-string@1.2.2(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjwa@1.0.2(transitive)
+ Addedjws@3.0.0(transitive)
+ Addedlodash@4.11.2(transitive)
+ Addedmap-obj@1.0.1(transitive)
+ Addedmeow@2.0.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedobject-assign@1.0.0(transitive)
+ Addedqs@6.2.4(transitive)
+ Addedreadable-stream@1.1.142.0.6(transitive)
+ Addedrepeating@1.1.3(transitive)
+ Addedrequest@2.74.0(transitive)
+ Addedstring-template@0.2.1(transitive)
+ Addedstring_decoder@0.10.31(transitive)
- Removed@google-cloud/common@0.11.0(transitive)
- Removedgoogle-gax@0.10.8(transitive)
- Removedgoogle-proto-files@0.9.1(transitive)
- Removedlog-driver@1.2.7(transitive)
Updated@google-cloud/common@^0.8.0
Updatedgoogle-gax@^0.9.1