public class CloudVisionTemplate extends Object
Constructor and Description |
---|
CloudVisionTemplate(ImageAnnotatorClient imageAnnotatorClient) |
Modifier and Type | Method and Description |
---|---|
AnnotateImageResponse |
analyzeImage(org.springframework.core.io.Resource imageResource,
Feature.Type... featureTypes)
Analyze an image and extract the features of the image specified by
featureTypes . |
AnnotateImageResponse |
analyzeImage(org.springframework.core.io.Resource imageResource,
ImageContext imageContext,
Feature.Type... featureTypes)
Analyze an image and extract the features of the image specified by
featureTypes . |
String |
extractTextFromImage(org.springframework.core.io.Resource imageResource)
Extract the text out of an image and return the result as a String.
|
String |
extractTextFromImage(org.springframework.core.io.Resource imageResource,
ImageContext imageContext)
Extract the text out of an image and return the result as a String.
|
public CloudVisionTemplate(ImageAnnotatorClient imageAnnotatorClient)
public String extractTextFromImage(org.springframework.core.io.Resource imageResource)
imageResource
- the image one wishes to analyzeCloudVisionException
- if the image could not be read or if text extraction failedpublic String extractTextFromImage(org.springframework.core.io.Resource imageResource, ImageContext imageContext)
imageResource
- the image one wishes to analyzeimageContext
- the image context to customize the text extraction requestCloudVisionException
- if the image could not be read or if text extraction failedpublic AnnotateImageResponse analyzeImage(org.springframework.core.io.Resource imageResource, Feature.Type... featureTypes)
featureTypes
.
A feature describes the kind of Cloud Vision analysis one wishes to perform on an
image, such as text detection, image labelling, facial detection, etc. A full list of
feature types can be found in Feature.Type
.
imageResource
- the image one wishes to analyze. The Cloud Vision APIs support
image formats described here: https://cloud.google.com/vision/docs/supported-filesfeatureTypes
- the types of image analysis to perform on the imageCloudVisionException
- if the image could not be read or if a malformed response
is received from the Cloud Vision APIspublic AnnotateImageResponse analyzeImage(org.springframework.core.io.Resource imageResource, ImageContext imageContext, Feature.Type... featureTypes)
featureTypes
.
A feature describes the kind of Cloud Vision analysis one wishes to perform on an
image, such as text detection, image labelling, facial detection, etc. A full list of
feature types can be found in Feature.Type
.
imageResource
- the image one wishes to analyze. The Cloud Vision APIs support
image formats described here: https://cloud.google.com/vision/docs/supported-filesimageContext
- the image context used to customize the Vision API requestfeatureTypes
- the types of image analysis to perform on the imageCloudVisionException
- if the image could not be read or if a malformed response
is received from the Cloud Vision APIsCopyright © 2021. All rights reserved.