@@ -94,21 +94,17 @@ def source(self):
9494 """
9595 return self ._source
9696
97- def _detect_annotation (self , features ):
97+ def _detect_annotation (self , images ):
9898 """Generic method for detecting annotations.
9999
100- :type features: list
101- :param features: List of :class:`~google.cloud.vision.feature.Feature`
102- indicating the type of annotations to perform.
100+ :type images: list
101+ :param images: List of :class:`~google.cloud.vision.image.Image`.
103102
104103 :rtype: list
105104 :returns: List of
106- :class:`~google.cloud.vision.entity.EntityAnnotation`,
107- :class:`~google.cloud.vision.face.Face`,
108- :class:`~google.cloud.vision.color.ImagePropertiesAnnotation`,
109- :class:`~google.cloud.vision.sage.SafeSearchAnnotation`,
105+ :class:`~google.cloud.vision.annotations.Annotations`.
110106 """
111- return self .client ._vision_api .annotate (self , features )
107+ return self .client ._vision_api .annotate (images )
112108
113109 def detect (self , features ):
114110 """Detect multiple feature types.
@@ -121,7 +117,8 @@ def detect(self, features):
121117 :returns: List of
122118 :class:`~google.cloud.vision.entity.EntityAnnotation`.
123119 """
124- return self ._detect_annotation (features )
120+ images = ((self , features ),)
121+ return self ._detect_annotation (images )
125122
126123 def detect_faces (self , limit = 10 ):
127124 """Detect faces in image.
@@ -133,7 +130,7 @@ def detect_faces(self, limit=10):
133130 :returns: List of :class:`~google.cloud.vision.face.Face`.
134131 """
135132 features = [Feature (FeatureTypes .FACE_DETECTION , limit )]
136- annotations = self ._detect_annotation (features )
133+ annotations = self .detect (features )
137134 return annotations [0 ].faces
138135
139136 def detect_labels (self , limit = 10 ):
@@ -146,7 +143,7 @@ def detect_labels(self, limit=10):
146143 :returns: List of :class:`~google.cloud.vision.entity.EntityAnnotation`
147144 """
148145 features = [Feature (FeatureTypes .LABEL_DETECTION , limit )]
149- annotations = self ._detect_annotation (features )
146+ annotations = self .detect (features )
150147 return annotations [0 ].labels
151148
152149 def detect_landmarks (self , limit = 10 ):
@@ -160,7 +157,7 @@ def detect_landmarks(self, limit=10):
160157 :class:`~google.cloud.vision.entity.EntityAnnotation`.
161158 """
162159 features = [Feature (FeatureTypes .LANDMARK_DETECTION , limit )]
163- annotations = self ._detect_annotation (features )
160+ annotations = self .detect (features )
164161 return annotations [0 ].landmarks
165162
166163 def detect_logos (self , limit = 10 ):
@@ -174,7 +171,7 @@ def detect_logos(self, limit=10):
174171 :class:`~google.cloud.vision.entity.EntityAnnotation`.
175172 """
176173 features = [Feature (FeatureTypes .LOGO_DETECTION , limit )]
177- annotations = self ._detect_annotation (features )
174+ annotations = self .detect (features )
178175 return annotations [0 ].logos
179176
180177 def detect_properties (self , limit = 10 ):
@@ -188,7 +185,7 @@ def detect_properties(self, limit=10):
188185 :class:`~google.cloud.vision.color.ImagePropertiesAnnotation`.
189186 """
190187 features = [Feature (FeatureTypes .IMAGE_PROPERTIES , limit )]
191- annotations = self ._detect_annotation (features )
188+ annotations = self .detect (features )
192189 return annotations [0 ].properties
193190
194191 def detect_safe_search (self , limit = 10 ):
@@ -202,7 +199,7 @@ def detect_safe_search(self, limit=10):
202199 :class:`~google.cloud.vision.sage.SafeSearchAnnotation`.
203200 """
204201 features = [Feature (FeatureTypes .SAFE_SEARCH_DETECTION , limit )]
205- annotations = self ._detect_annotation (features )
202+ annotations = self .detect (features )
206203 return annotations [0 ].safe_searches
207204
208205 def detect_text (self , limit = 10 ):
@@ -216,5 +213,5 @@ def detect_text(self, limit=10):
216213 :class:`~google.cloud.vision.entity.EntityAnnotation`.
217214 """
218215 features = [Feature (FeatureTypes .TEXT_DETECTION , limit )]
219- annotations = self ._detect_annotation (features )
216+ annotations = self .detect (features )
220217 return annotations [0 ].texts
0 commit comments