You need to turn it on manually to be available. Let’s see and enable on your developer console.
Set up a service account on credentials page and get a service account credentials json file.
Export export a service account json file into GOOGLE_APPLICATION_CREDENTIALS
env variable:
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
To run this sample, you need to install these packages:
- golang.org/x/net/context
- golang.org/x/oauth2/google
- google.golang.org/api/vision/...
To install all of them at once, type:
go get github.com/hermanschaaf/go-cloud-vision-api/...
Type the below command to install if you use this application on your device.
go get github.com/hermanschaaf/go-cloud-vision-api
Make sure that go-cloud-vision-api
was installed correctly:
go-cloud-vision-api -h
go run main.go lenna.jpg
or if you already installed as a command.
go-cloud-vision-api lenna.jpg
[
{
"faceAnnotations": [
{
"angerLikelihood": "VERY_UNLIKELY",
"blurredLikelihood": "VERY_UNLIKELY",
"boundingPoly": {
"vertices": [
{
"x": 143,
"y": 43
},
{
"x": 245,
"y": 43
},
{
"x": 245,
"y": 163
},
{
"x": 143,
"y": 163
}
]
},
"detectionConfidence": 0.99805844,
"fdBoundingPoly": {
"vertices": [
{
"x": 172,
"y": 82
},
{
"x": 241,
"y": 82
},
{
"x": 241,
"y": 151
},
{
"x": 172,
"y": 151
}
]
},
"headwearLikelihood": "UNLIKELY",
"joyLikelihood": "VERY_UNLIKELY",
"landmarkingConfidence": 0.5350582,
"landmarks": [
{
"position": {
"x": 197.90556,
"y": 102.932,
"z": 0.00083794753
},
"type": "LEFT_EYE"
},
{
"position": {
"x": 223.43489,
"y": 102.72927,
"z": 17.352478
},
"type": "RIGHT_EYE"
},
{
"position": {
"x": 189.50327,
"y": 96.40799,
"z": -4.1362653
},
"type": "LEFT_OF_LEFT_EYEBROW"
},
...
Shintaro Kaneko kaneshin0120@gmail.com