-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.
Description
Customer wondered how to pass a crop hint option to Vision#cropHints(). Turns out, you can't. The helper methods only accept an Image and a grpc options object, and do not accept imageContext.
In order to pass say, the aspectRatios option as part of the cropHints request, you have to use the annotateImage method directly, like so:
const Vision = require('@google-cloud/vision');
const vision = Vision();
vision.annotateImage({
image: {
source: {
filename: '/path/to/image.png'
}
},
features: [{ type: Vision.types.Feature.Type.CROP_HINTS }],
imageContext: {
cropHintsParams: {
aspectRatios: [0.25]
}
}
}).then(...);I'm not sure how folks are supposed to know this.
imageContext itself isn't even documented on the annotateImage method
Also, accessing the enum (e.g. Vision.types.Feature.Type.CROP_HINTS) is only documented in the client library's README, and even then, only for FACE_DETECTION.
akashdathan, quynhdang-vt and baj84
Metadata
Metadata
Assignees
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.