-
Notifications
You must be signed in to change notification settings - Fork 12
/
feature.go
56 lines (52 loc) · 1.39 KB
/
feature.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package pigeon
import (
vision "google.golang.org/api/vision/v1"
)
const (
// TypeUnspecified - Unspecified feature type.
TypeUnspecified = iota
// FaceDetection - Run face detection.
FaceDetection
// LandmarkDetection - Run landmark detection.
LandmarkDetection
// LogoDetection - Run logo detection.
LogoDetection
// LabelDetection - Run label detection.
LabelDetection
// TextDetection - Run OCR with big text
TextDetection
// DocumentTextDetection - Run OCR on document
DocumentTextDetection
// SafeSearchDetection - Run various computer vision models to
SafeSearchDetection
// ImageProperties - compute image safe-search properties.
ImageProperties
)
// DetectionType returns a value of detection type.
func DetectionType(d int) string {
switch d {
case TypeUnspecified:
return "TYPE_UNSPECIFIED"
case FaceDetection:
return "FACE_DETECTION"
case LandmarkDetection:
return "LANDMARK_DETECTION"
case LogoDetection:
return "LOGO_DETECTION"
case LabelDetection:
return "LABEL_DETECTION"
case TextDetection:
return "TEXT_DETECTION"
case DocumentTextDetection:
return "DOCUMENT_TEXT_DETECTION"
case SafeSearchDetection:
return "SAFE_SEARCH_DETECTION"
case ImageProperties:
return "IMAGE_PROPERTIES"
}
return ""
}
// NewFeature returns a pointer to a new vision's Feature object.
func NewFeature(d int) *vision.Feature {
return &vision.Feature{Type: DetectionType(d)}
}