google-cloud-vision 0.32.1 → 0.32.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/vision/v1/helpers.rb +116 -18
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +116 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52dd46891e2dd5c9808632ba5b9ac31a1365170bea2da85e742a6bcc7d93aa17
|
4
|
+
data.tar.gz: e1ef13baff8bb0c1d9f7b6fd501300906ef366c829fc213acdd8e735fb6b4751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1130a631b6b852c00ae75cac33d59a713e122e6ebd14acbbb551a7039b4da5c50fe80bafdf30e39a28f93536a25729d0f0507d60bbe526b6063c8a51c0396e9f
|
7
|
+
data.tar.gz: 12164c275468ab3331493a60ce1fb65d3748c3c541035c4d0f0b63563caa1623f9e3d76fc93211e13341b3b3a6faf0a82ff89f09f19fcbf0d9c326cac762e9ca
|
@@ -39,6 +39,8 @@ module Google
|
|
39
39
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
40
40
|
# @param destination [String]
|
41
41
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
42
|
+
# @param image_context [Hash<Any>]
|
43
|
+
# Optional. Image context and/or feature-specific parameters.
|
42
44
|
# @yield [result, operation] Access the result along with the RPC operation
|
43
45
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
44
46
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -62,6 +64,7 @@ module Google
|
|
62
64
|
mime_type: nil,
|
63
65
|
batch_size: 10,
|
64
66
|
destination: nil,
|
67
|
+
image_context: nil,
|
65
68
|
&blk
|
66
69
|
|
67
70
|
feature = { type: :FACE_DETECTION }
|
@@ -75,10 +78,12 @@ module Google
|
|
75
78
|
end
|
76
79
|
|
77
80
|
requests = formatted_images.map do |img|
|
78
|
-
{
|
81
|
+
request = {
|
79
82
|
image: img,
|
80
83
|
features: [feature]
|
81
84
|
}
|
85
|
+
request[:image_context] = image_context if image_context
|
86
|
+
request
|
82
87
|
end
|
83
88
|
|
84
89
|
if async
|
@@ -123,6 +128,8 @@ module Google
|
|
123
128
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
124
129
|
# @param destination [String]
|
125
130
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
131
|
+
# @param image_context [Hash<Any>]
|
132
|
+
# Optional. Image context and/or feature-specific parameters.
|
126
133
|
# @yield [result, operation] Access the result along with the RPC operation
|
127
134
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
128
135
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -146,6 +153,7 @@ module Google
|
|
146
153
|
mime_type: nil,
|
147
154
|
batch_size: 10,
|
148
155
|
destination: nil,
|
156
|
+
image_context: nil,
|
149
157
|
&blk
|
150
158
|
|
151
159
|
feature = { type: :LANDMARK_DETECTION }
|
@@ -159,10 +167,12 @@ module Google
|
|
159
167
|
end
|
160
168
|
|
161
169
|
requests = formatted_images.map do |img|
|
162
|
-
{
|
170
|
+
request = {
|
163
171
|
image: img,
|
164
172
|
features: [feature]
|
165
173
|
}
|
174
|
+
request[:image_context] = image_context if image_context
|
175
|
+
request
|
166
176
|
end
|
167
177
|
|
168
178
|
if async
|
@@ -207,6 +217,8 @@ module Google
|
|
207
217
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
208
218
|
# @param destination [String]
|
209
219
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
220
|
+
# @param image_context [Hash<Any>]
|
221
|
+
# Optional. Image context and/or feature-specific parameters.
|
210
222
|
# @yield [result, operation] Access the result along with the RPC operation
|
211
223
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
212
224
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -230,6 +242,7 @@ module Google
|
|
230
242
|
mime_type: nil,
|
231
243
|
batch_size: 10,
|
232
244
|
destination: nil,
|
245
|
+
image_context: nil,
|
233
246
|
&blk
|
234
247
|
|
235
248
|
feature = { type: :LOGO_DETECTION }
|
@@ -243,10 +256,12 @@ module Google
|
|
243
256
|
end
|
244
257
|
|
245
258
|
requests = formatted_images.map do |img|
|
246
|
-
{
|
259
|
+
request = {
|
247
260
|
image: img,
|
248
261
|
features: [feature]
|
249
262
|
}
|
263
|
+
request[:image_context] = image_context if image_context
|
264
|
+
request
|
250
265
|
end
|
251
266
|
|
252
267
|
if async
|
@@ -291,6 +306,8 @@ module Google
|
|
291
306
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
292
307
|
# @param destination [String]
|
293
308
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
309
|
+
# @param image_context [Hash<Any>]
|
310
|
+
# Optional. Image context and/or feature-specific parameters.
|
294
311
|
# @yield [result, operation] Access the result along with the RPC operation
|
295
312
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
296
313
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -314,6 +331,7 @@ module Google
|
|
314
331
|
mime_type: nil,
|
315
332
|
batch_size: 10,
|
316
333
|
destination: nil,
|
334
|
+
image_context: nil,
|
317
335
|
&blk
|
318
336
|
|
319
337
|
feature = { type: :LABEL_DETECTION }
|
@@ -327,10 +345,12 @@ module Google
|
|
327
345
|
end
|
328
346
|
|
329
347
|
requests = formatted_images.map do |img|
|
330
|
-
{
|
348
|
+
request = {
|
331
349
|
image: img,
|
332
350
|
features: [feature]
|
333
351
|
}
|
352
|
+
request[:image_context] = image_context if image_context
|
353
|
+
request
|
334
354
|
end
|
335
355
|
|
336
356
|
if async
|
@@ -375,6 +395,8 @@ module Google
|
|
375
395
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
376
396
|
# @param destination [String]
|
377
397
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
398
|
+
# @param image_context [Hash<Any>]
|
399
|
+
# Optional. Image context and/or feature-specific parameters.
|
378
400
|
# @yield [result, operation] Access the result along with the RPC operation
|
379
401
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
380
402
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -398,6 +420,7 @@ module Google
|
|
398
420
|
mime_type: nil,
|
399
421
|
batch_size: 10,
|
400
422
|
destination: nil,
|
423
|
+
image_context: nil,
|
401
424
|
&blk
|
402
425
|
|
403
426
|
feature = { type: :TEXT_DETECTION }
|
@@ -411,10 +434,12 @@ module Google
|
|
411
434
|
end
|
412
435
|
|
413
436
|
requests = formatted_images.map do |img|
|
414
|
-
{
|
437
|
+
request = {
|
415
438
|
image: img,
|
416
439
|
features: [feature]
|
417
440
|
}
|
441
|
+
request[:image_context] = image_context if image_context
|
442
|
+
request
|
418
443
|
end
|
419
444
|
|
420
445
|
if async
|
@@ -459,6 +484,8 @@ module Google
|
|
459
484
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
460
485
|
# @param destination [String]
|
461
486
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
487
|
+
# @param image_context [Hash<Any>]
|
488
|
+
# Optional. Image context and/or feature-specific parameters.
|
462
489
|
# @yield [result, operation] Access the result along with the RPC operation
|
463
490
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
464
491
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -482,6 +509,7 @@ module Google
|
|
482
509
|
mime_type: nil,
|
483
510
|
batch_size: 10,
|
484
511
|
destination: nil,
|
512
|
+
image_context: nil,
|
485
513
|
&blk
|
486
514
|
|
487
515
|
feature = { type: :DOCUMENT_TEXT_DETECTION }
|
@@ -495,10 +523,12 @@ module Google
|
|
495
523
|
end
|
496
524
|
|
497
525
|
requests = formatted_images.map do |img|
|
498
|
-
{
|
526
|
+
request = {
|
499
527
|
image: img,
|
500
528
|
features: [feature]
|
501
529
|
}
|
530
|
+
request[:image_context] = image_context if image_context
|
531
|
+
request
|
502
532
|
end
|
503
533
|
|
504
534
|
if async
|
@@ -543,6 +573,8 @@ module Google
|
|
543
573
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
544
574
|
# @param destination [String]
|
545
575
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
576
|
+
# @param image_context [Hash<Any>]
|
577
|
+
# Optional. Image context and/or feature-specific parameters.
|
546
578
|
# @yield [result, operation] Access the result along with the RPC operation
|
547
579
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
548
580
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -566,6 +598,7 @@ module Google
|
|
566
598
|
mime_type: nil,
|
567
599
|
batch_size: 10,
|
568
600
|
destination: nil,
|
601
|
+
image_context: nil,
|
569
602
|
&blk
|
570
603
|
|
571
604
|
feature = { type: :SAFE_SEARCH_DETECTION }
|
@@ -579,10 +612,12 @@ module Google
|
|
579
612
|
end
|
580
613
|
|
581
614
|
requests = formatted_images.map do |img|
|
582
|
-
{
|
615
|
+
request = {
|
583
616
|
image: img,
|
584
617
|
features: [feature]
|
585
618
|
}
|
619
|
+
request[:image_context] = image_context if image_context
|
620
|
+
request
|
586
621
|
end
|
587
622
|
|
588
623
|
if async
|
@@ -627,6 +662,8 @@ module Google
|
|
627
662
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
628
663
|
# @param destination [String]
|
629
664
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
665
|
+
# @param image_context [Hash<Any>]
|
666
|
+
# Optional. Image context and/or feature-specific parameters.
|
630
667
|
# @yield [result, operation] Access the result along with the RPC operation
|
631
668
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
632
669
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -650,6 +687,7 @@ module Google
|
|
650
687
|
mime_type: nil,
|
651
688
|
batch_size: 10,
|
652
689
|
destination: nil,
|
690
|
+
image_context: nil,
|
653
691
|
&blk
|
654
692
|
|
655
693
|
feature = { type: :IMAGE_PROPERTIES }
|
@@ -663,10 +701,12 @@ module Google
|
|
663
701
|
end
|
664
702
|
|
665
703
|
requests = formatted_images.map do |img|
|
666
|
-
{
|
704
|
+
request = {
|
667
705
|
image: img,
|
668
706
|
features: [feature]
|
669
707
|
}
|
708
|
+
request[:image_context] = image_context if image_context
|
709
|
+
request
|
670
710
|
end
|
671
711
|
|
672
712
|
if async
|
@@ -711,6 +751,8 @@ module Google
|
|
711
751
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
712
752
|
# @param destination [String]
|
713
753
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
754
|
+
# @param image_context [Hash<Any>]
|
755
|
+
# Optional. Image context and/or feature-specific parameters.
|
714
756
|
# @yield [result, operation] Access the result along with the RPC operation
|
715
757
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
716
758
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -720,12 +762,12 @@ module Google
|
|
720
762
|
#
|
721
763
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
722
764
|
#
|
723
|
-
# response = image_annotator_client.
|
765
|
+
# response = image_annotator_client.web_detection image: "path\to\image.png"
|
724
766
|
# response.responses.each do |res|
|
725
767
|
# puts res
|
726
768
|
# end
|
727
769
|
|
728
|
-
def
|
770
|
+
def web_detection \
|
729
771
|
images: [],
|
730
772
|
image: nil,
|
731
773
|
max_results: 10,
|
@@ -734,9 +776,10 @@ module Google
|
|
734
776
|
mime_type: nil,
|
735
777
|
batch_size: 10,
|
736
778
|
destination: nil,
|
779
|
+
image_context: nil,
|
737
780
|
&blk
|
738
781
|
|
739
|
-
feature = { type: :
|
782
|
+
feature = { type: :WEB_DETECTION }
|
740
783
|
feature[:max_results] = max_results
|
741
784
|
images << image if image
|
742
785
|
|
@@ -747,10 +790,12 @@ module Google
|
|
747
790
|
end
|
748
791
|
|
749
792
|
requests = formatted_images.map do |img|
|
750
|
-
{
|
793
|
+
request = {
|
751
794
|
image: img,
|
752
795
|
features: [feature]
|
753
796
|
}
|
797
|
+
request[:image_context] = image_context if image_context
|
798
|
+
request
|
754
799
|
end
|
755
800
|
|
756
801
|
if async
|
@@ -795,6 +840,8 @@ module Google
|
|
795
840
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
796
841
|
# @param destination [String]
|
797
842
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
843
|
+
# @param image_context [Hash<Any>]
|
844
|
+
# Optional. Image context and/or feature-specific parameters.
|
798
845
|
# @yield [result, operation] Access the result along with the RPC operation
|
799
846
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
800
847
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -818,6 +865,7 @@ module Google
|
|
818
865
|
mime_type: nil,
|
819
866
|
batch_size: 10,
|
820
867
|
destination: nil,
|
868
|
+
image_context: nil,
|
821
869
|
&blk
|
822
870
|
|
823
871
|
feature = { type: :PRODUCT_SEARCH }
|
@@ -831,10 +879,12 @@ module Google
|
|
831
879
|
end
|
832
880
|
|
833
881
|
requests = formatted_images.map do |img|
|
834
|
-
{
|
882
|
+
request = {
|
835
883
|
image: img,
|
836
884
|
features: [feature]
|
837
885
|
}
|
886
|
+
request[:image_context] = image_context if image_context
|
887
|
+
request
|
838
888
|
end
|
839
889
|
|
840
890
|
if async
|
@@ -879,6 +929,8 @@ module Google
|
|
879
929
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
880
930
|
# @param destination [String]
|
881
931
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
932
|
+
# @param image_context [Hash<Any>]
|
933
|
+
# Optional. Image context and/or feature-specific parameters.
|
882
934
|
# @yield [result, operation] Access the result along with the RPC operation
|
883
935
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
884
936
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -902,6 +954,7 @@ module Google
|
|
902
954
|
mime_type: nil,
|
903
955
|
batch_size: 10,
|
904
956
|
destination: nil,
|
957
|
+
image_context: nil,
|
905
958
|
&blk
|
906
959
|
|
907
960
|
feature = { type: :OBJECT_LOCALIZATION }
|
@@ -915,10 +968,12 @@ module Google
|
|
915
968
|
end
|
916
969
|
|
917
970
|
requests = formatted_images.map do |img|
|
918
|
-
{
|
971
|
+
request = {
|
919
972
|
image: img,
|
920
973
|
features: [feature]
|
921
974
|
}
|
975
|
+
request[:image_context] = image_context if image_context
|
976
|
+
request
|
922
977
|
end
|
923
978
|
|
924
979
|
if async
|
@@ -963,6 +1018,8 @@ module Google
|
|
963
1018
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
964
1019
|
# @param destination [String]
|
965
1020
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
1021
|
+
# @param image_context [Hash<Any>]
|
1022
|
+
# Optional. Image context and/or feature-specific parameters.
|
966
1023
|
# @yield [result, operation] Access the result along with the RPC operation
|
967
1024
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
968
1025
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -972,12 +1029,12 @@ module Google
|
|
972
1029
|
#
|
973
1030
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
|
974
1031
|
#
|
975
|
-
# response = image_annotator_client.
|
1032
|
+
# response = image_annotator_client.crop_hints_detection image: "path\to\image.png"
|
976
1033
|
# response.responses.each do |res|
|
977
1034
|
# puts res
|
978
1035
|
# end
|
979
1036
|
|
980
|
-
def
|
1037
|
+
def crop_hints_detection \
|
981
1038
|
images: [],
|
982
1039
|
image: nil,
|
983
1040
|
max_results: 10,
|
@@ -986,9 +1043,10 @@ module Google
|
|
986
1043
|
mime_type: nil,
|
987
1044
|
batch_size: 10,
|
988
1045
|
destination: nil,
|
1046
|
+
image_context: nil,
|
989
1047
|
&blk
|
990
1048
|
|
991
|
-
feature = { type: :
|
1049
|
+
feature = { type: :CROP_HINTS }
|
992
1050
|
feature[:max_results] = max_results
|
993
1051
|
images << image if image
|
994
1052
|
|
@@ -999,10 +1057,12 @@ module Google
|
|
999
1057
|
end
|
1000
1058
|
|
1001
1059
|
requests = formatted_images.map do |img|
|
1002
|
-
{
|
1060
|
+
request = {
|
1003
1061
|
image: img,
|
1004
1062
|
features: [feature]
|
1005
1063
|
}
|
1064
|
+
request[:image_context] = image_context if image_context
|
1065
|
+
request
|
1006
1066
|
end
|
1007
1067
|
|
1008
1068
|
if async
|
@@ -1050,6 +1110,44 @@ module Google
|
|
1050
1110
|
formatted_image
|
1051
1111
|
end
|
1052
1112
|
end
|
1113
|
+
|
1114
|
+
class ProductSearchClient
|
1115
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.location_path.
|
1116
|
+
# @param project [String]
|
1117
|
+
# @param location [String]
|
1118
|
+
# @return [String]
|
1119
|
+
def location_path project, location
|
1120
|
+
self.class.location_path project, location
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_set_path.
|
1124
|
+
# @param project [String]
|
1125
|
+
# @param location [String]
|
1126
|
+
# @param product_set [String]
|
1127
|
+
# @return [String]
|
1128
|
+
def product_set_path project, location, product_set
|
1129
|
+
self.class.product_set_path project, location, product_set
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.product_path.
|
1133
|
+
# @param project [String]
|
1134
|
+
# @param location [String]
|
1135
|
+
# @param product [String]
|
1136
|
+
# @return [String]
|
1137
|
+
def product_path project, location, product
|
1138
|
+
self.class.product_path project, location, product
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
# Alias for Google::Cloud::Vision::V1::ProductSearchClient.reference_image_path.
|
1142
|
+
# @param project [String]
|
1143
|
+
# @param location [String]
|
1144
|
+
# @param product [String]
|
1145
|
+
# @param reference_image [String]
|
1146
|
+
# @return [String]
|
1147
|
+
def reference_image_path project, location, product, reference_image
|
1148
|
+
self.class.reference_image_path project, location, product, reference_image
|
1149
|
+
end
|
1150
|
+
end
|
1053
1151
|
end
|
1054
1152
|
end
|
1055
1153
|
end
|
@@ -39,6 +39,8 @@ module Google
|
|
39
39
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
40
40
|
# @param destination [String]
|
41
41
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
42
|
+
# @param image_context [Hash<Any>]
|
43
|
+
# Optional. Image context and/or feature-specific parameters.
|
42
44
|
# @yield [result, operation] Access the result along with the RPC operation
|
43
45
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
44
46
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -62,6 +64,7 @@ module Google
|
|
62
64
|
mime_type: nil,
|
63
65
|
batch_size: 10,
|
64
66
|
destination: nil,
|
67
|
+
image_context: nil,
|
65
68
|
&blk
|
66
69
|
|
67
70
|
feature = { type: :FACE_DETECTION }
|
@@ -75,10 +78,12 @@ module Google
|
|
75
78
|
end
|
76
79
|
|
77
80
|
requests = formatted_images.map do |img|
|
78
|
-
{
|
81
|
+
request = {
|
79
82
|
image: img,
|
80
83
|
features: [feature]
|
81
84
|
}
|
85
|
+
request[:image_context] = image_context if image_context
|
86
|
+
request
|
82
87
|
end
|
83
88
|
|
84
89
|
if async
|
@@ -123,6 +128,8 @@ module Google
|
|
123
128
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
124
129
|
# @param destination [String]
|
125
130
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
131
|
+
# @param image_context [Hash<Any>]
|
132
|
+
# Optional. Image context and/or feature-specific parameters.
|
126
133
|
# @yield [result, operation] Access the result along with the RPC operation
|
127
134
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
128
135
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -146,6 +153,7 @@ module Google
|
|
146
153
|
mime_type: nil,
|
147
154
|
batch_size: 10,
|
148
155
|
destination: nil,
|
156
|
+
image_context: nil,
|
149
157
|
&blk
|
150
158
|
|
151
159
|
feature = { type: :LANDMARK_DETECTION }
|
@@ -159,10 +167,12 @@ module Google
|
|
159
167
|
end
|
160
168
|
|
161
169
|
requests = formatted_images.map do |img|
|
162
|
-
{
|
170
|
+
request = {
|
163
171
|
image: img,
|
164
172
|
features: [feature]
|
165
173
|
}
|
174
|
+
request[:image_context] = image_context if image_context
|
175
|
+
request
|
166
176
|
end
|
167
177
|
|
168
178
|
if async
|
@@ -207,6 +217,8 @@ module Google
|
|
207
217
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
208
218
|
# @param destination [String]
|
209
219
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
220
|
+
# @param image_context [Hash<Any>]
|
221
|
+
# Optional. Image context and/or feature-specific parameters.
|
210
222
|
# @yield [result, operation] Access the result along with the RPC operation
|
211
223
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
212
224
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -230,6 +242,7 @@ module Google
|
|
230
242
|
mime_type: nil,
|
231
243
|
batch_size: 10,
|
232
244
|
destination: nil,
|
245
|
+
image_context: nil,
|
233
246
|
&blk
|
234
247
|
|
235
248
|
feature = { type: :LOGO_DETECTION }
|
@@ -243,10 +256,12 @@ module Google
|
|
243
256
|
end
|
244
257
|
|
245
258
|
requests = formatted_images.map do |img|
|
246
|
-
{
|
259
|
+
request = {
|
247
260
|
image: img,
|
248
261
|
features: [feature]
|
249
262
|
}
|
263
|
+
request[:image_context] = image_context if image_context
|
264
|
+
request
|
250
265
|
end
|
251
266
|
|
252
267
|
if async
|
@@ -291,6 +306,8 @@ module Google
|
|
291
306
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
292
307
|
# @param destination [String]
|
293
308
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
309
|
+
# @param image_context [Hash<Any>]
|
310
|
+
# Optional. Image context and/or feature-specific parameters.
|
294
311
|
# @yield [result, operation] Access the result along with the RPC operation
|
295
312
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
296
313
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -314,6 +331,7 @@ module Google
|
|
314
331
|
mime_type: nil,
|
315
332
|
batch_size: 10,
|
316
333
|
destination: nil,
|
334
|
+
image_context: nil,
|
317
335
|
&blk
|
318
336
|
|
319
337
|
feature = { type: :LABEL_DETECTION }
|
@@ -327,10 +345,12 @@ module Google
|
|
327
345
|
end
|
328
346
|
|
329
347
|
requests = formatted_images.map do |img|
|
330
|
-
{
|
348
|
+
request = {
|
331
349
|
image: img,
|
332
350
|
features: [feature]
|
333
351
|
}
|
352
|
+
request[:image_context] = image_context if image_context
|
353
|
+
request
|
334
354
|
end
|
335
355
|
|
336
356
|
if async
|
@@ -375,6 +395,8 @@ module Google
|
|
375
395
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
376
396
|
# @param destination [String]
|
377
397
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
398
|
+
# @param image_context [Hash<Any>]
|
399
|
+
# Optional. Image context and/or feature-specific parameters.
|
378
400
|
# @yield [result, operation] Access the result along with the RPC operation
|
379
401
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
380
402
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -398,6 +420,7 @@ module Google
|
|
398
420
|
mime_type: nil,
|
399
421
|
batch_size: 10,
|
400
422
|
destination: nil,
|
423
|
+
image_context: nil,
|
401
424
|
&blk
|
402
425
|
|
403
426
|
feature = { type: :TEXT_DETECTION }
|
@@ -411,10 +434,12 @@ module Google
|
|
411
434
|
end
|
412
435
|
|
413
436
|
requests = formatted_images.map do |img|
|
414
|
-
{
|
437
|
+
request = {
|
415
438
|
image: img,
|
416
439
|
features: [feature]
|
417
440
|
}
|
441
|
+
request[:image_context] = image_context if image_context
|
442
|
+
request
|
418
443
|
end
|
419
444
|
|
420
445
|
if async
|
@@ -459,6 +484,8 @@ module Google
|
|
459
484
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
460
485
|
# @param destination [String]
|
461
486
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
487
|
+
# @param image_context [Hash<Any>]
|
488
|
+
# Optional. Image context and/or feature-specific parameters.
|
462
489
|
# @yield [result, operation] Access the result along with the RPC operation
|
463
490
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
464
491
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -482,6 +509,7 @@ module Google
|
|
482
509
|
mime_type: nil,
|
483
510
|
batch_size: 10,
|
484
511
|
destination: nil,
|
512
|
+
image_context: nil,
|
485
513
|
&blk
|
486
514
|
|
487
515
|
feature = { type: :DOCUMENT_TEXT_DETECTION }
|
@@ -495,10 +523,12 @@ module Google
|
|
495
523
|
end
|
496
524
|
|
497
525
|
requests = formatted_images.map do |img|
|
498
|
-
{
|
526
|
+
request = {
|
499
527
|
image: img,
|
500
528
|
features: [feature]
|
501
529
|
}
|
530
|
+
request[:image_context] = image_context if image_context
|
531
|
+
request
|
502
532
|
end
|
503
533
|
|
504
534
|
if async
|
@@ -543,6 +573,8 @@ module Google
|
|
543
573
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
544
574
|
# @param destination [String]
|
545
575
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
576
|
+
# @param image_context [Hash<Any>]
|
577
|
+
# Optional. Image context and/or feature-specific parameters.
|
546
578
|
# @yield [result, operation] Access the result along with the RPC operation
|
547
579
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
548
580
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -566,6 +598,7 @@ module Google
|
|
566
598
|
mime_type: nil,
|
567
599
|
batch_size: 10,
|
568
600
|
destination: nil,
|
601
|
+
image_context: nil,
|
569
602
|
&blk
|
570
603
|
|
571
604
|
feature = { type: :SAFE_SEARCH_DETECTION }
|
@@ -579,10 +612,12 @@ module Google
|
|
579
612
|
end
|
580
613
|
|
581
614
|
requests = formatted_images.map do |img|
|
582
|
-
{
|
615
|
+
request = {
|
583
616
|
image: img,
|
584
617
|
features: [feature]
|
585
618
|
}
|
619
|
+
request[:image_context] = image_context if image_context
|
620
|
+
request
|
586
621
|
end
|
587
622
|
|
588
623
|
if async
|
@@ -627,6 +662,8 @@ module Google
|
|
627
662
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
628
663
|
# @param destination [String]
|
629
664
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
665
|
+
# @param image_context [Hash<Any>]
|
666
|
+
# Optional. Image context and/or feature-specific parameters.
|
630
667
|
# @yield [result, operation] Access the result along with the RPC operation
|
631
668
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
632
669
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -650,6 +687,7 @@ module Google
|
|
650
687
|
mime_type: nil,
|
651
688
|
batch_size: 10,
|
652
689
|
destination: nil,
|
690
|
+
image_context: nil,
|
653
691
|
&blk
|
654
692
|
|
655
693
|
feature = { type: :IMAGE_PROPERTIES }
|
@@ -663,10 +701,12 @@ module Google
|
|
663
701
|
end
|
664
702
|
|
665
703
|
requests = formatted_images.map do |img|
|
666
|
-
{
|
704
|
+
request = {
|
667
705
|
image: img,
|
668
706
|
features: [feature]
|
669
707
|
}
|
708
|
+
request[:image_context] = image_context if image_context
|
709
|
+
request
|
670
710
|
end
|
671
711
|
|
672
712
|
if async
|
@@ -711,6 +751,8 @@ module Google
|
|
711
751
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
712
752
|
# @param destination [String]
|
713
753
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
754
|
+
# @param image_context [Hash<Any>]
|
755
|
+
# Optional. Image context and/or feature-specific parameters.
|
714
756
|
# @yield [result, operation] Access the result along with the RPC operation
|
715
757
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
716
758
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -720,12 +762,12 @@ module Google
|
|
720
762
|
#
|
721
763
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1p3beta1)
|
722
764
|
#
|
723
|
-
# response = image_annotator_client.
|
765
|
+
# response = image_annotator_client.web_detection image: "path\to\image.png"
|
724
766
|
# response.responses.each do |res|
|
725
767
|
# puts res
|
726
768
|
# end
|
727
769
|
|
728
|
-
def
|
770
|
+
def web_detection \
|
729
771
|
images: [],
|
730
772
|
image: nil,
|
731
773
|
max_results: 10,
|
@@ -734,9 +776,10 @@ module Google
|
|
734
776
|
mime_type: nil,
|
735
777
|
batch_size: 10,
|
736
778
|
destination: nil,
|
779
|
+
image_context: nil,
|
737
780
|
&blk
|
738
781
|
|
739
|
-
feature = { type: :
|
782
|
+
feature = { type: :WEB_DETECTION }
|
740
783
|
feature[:max_results] = max_results
|
741
784
|
images << image if image
|
742
785
|
|
@@ -747,10 +790,12 @@ module Google
|
|
747
790
|
end
|
748
791
|
|
749
792
|
requests = formatted_images.map do |img|
|
750
|
-
{
|
793
|
+
request = {
|
751
794
|
image: img,
|
752
795
|
features: [feature]
|
753
796
|
}
|
797
|
+
request[:image_context] = image_context if image_context
|
798
|
+
request
|
754
799
|
end
|
755
800
|
|
756
801
|
if async
|
@@ -795,6 +840,8 @@ module Google
|
|
795
840
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
796
841
|
# @param destination [String]
|
797
842
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
843
|
+
# @param image_context [Hash<Any>]
|
844
|
+
# Optional. Image context and/or feature-specific parameters.
|
798
845
|
# @yield [result, operation] Access the result along with the RPC operation
|
799
846
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
800
847
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -818,6 +865,7 @@ module Google
|
|
818
865
|
mime_type: nil,
|
819
866
|
batch_size: 10,
|
820
867
|
destination: nil,
|
868
|
+
image_context: nil,
|
821
869
|
&blk
|
822
870
|
|
823
871
|
feature = { type: :PRODUCT_SEARCH }
|
@@ -831,10 +879,12 @@ module Google
|
|
831
879
|
end
|
832
880
|
|
833
881
|
requests = formatted_images.map do |img|
|
834
|
-
{
|
882
|
+
request = {
|
835
883
|
image: img,
|
836
884
|
features: [feature]
|
837
885
|
}
|
886
|
+
request[:image_context] = image_context if image_context
|
887
|
+
request
|
838
888
|
end
|
839
889
|
|
840
890
|
if async
|
@@ -879,6 +929,8 @@ module Google
|
|
879
929
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
880
930
|
# @param destination [String]
|
881
931
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
932
|
+
# @param image_context [Hash<Any>]
|
933
|
+
# Optional. Image context and/or feature-specific parameters.
|
882
934
|
# @yield [result, operation] Access the result along with the RPC operation
|
883
935
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
884
936
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -902,6 +954,7 @@ module Google
|
|
902
954
|
mime_type: nil,
|
903
955
|
batch_size: 10,
|
904
956
|
destination: nil,
|
957
|
+
image_context: nil,
|
905
958
|
&blk
|
906
959
|
|
907
960
|
feature = { type: :OBJECT_LOCALIZATION }
|
@@ -915,10 +968,12 @@ module Google
|
|
915
968
|
end
|
916
969
|
|
917
970
|
requests = formatted_images.map do |img|
|
918
|
-
{
|
971
|
+
request = {
|
919
972
|
image: img,
|
920
973
|
features: [feature]
|
921
974
|
}
|
975
|
+
request[:image_context] = image_context if image_context
|
976
|
+
request
|
922
977
|
end
|
923
978
|
|
924
979
|
if async
|
@@ -963,6 +1018,8 @@ module Google
|
|
963
1018
|
# Optional. Defaults to 10. When async is true, this specifies the number of input files per output json.
|
964
1019
|
# @param destination [String]
|
965
1020
|
# Required only if async is true. A Google Cloud Storage location for storing the output.
|
1021
|
+
# @param image_context [Hash<Any>]
|
1022
|
+
# Optional. Image context and/or feature-specific parameters.
|
966
1023
|
# @yield [result, operation] Access the result along with the RPC operation
|
967
1024
|
# @yieldparam result [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
968
1025
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
@@ -972,12 +1029,12 @@ module Google
|
|
972
1029
|
#
|
973
1030
|
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1p3beta1)
|
974
1031
|
#
|
975
|
-
# response = image_annotator_client.
|
1032
|
+
# response = image_annotator_client.crop_hints_detection image: "path\to\image.png"
|
976
1033
|
# response.responses.each do |res|
|
977
1034
|
# puts res
|
978
1035
|
# end
|
979
1036
|
|
980
|
-
def
|
1037
|
+
def crop_hints_detection \
|
981
1038
|
images: [],
|
982
1039
|
image: nil,
|
983
1040
|
max_results: 10,
|
@@ -986,9 +1043,10 @@ module Google
|
|
986
1043
|
mime_type: nil,
|
987
1044
|
batch_size: 10,
|
988
1045
|
destination: nil,
|
1046
|
+
image_context: nil,
|
989
1047
|
&blk
|
990
1048
|
|
991
|
-
feature = { type: :
|
1049
|
+
feature = { type: :CROP_HINTS }
|
992
1050
|
feature[:max_results] = max_results
|
993
1051
|
images << image if image
|
994
1052
|
|
@@ -999,10 +1057,12 @@ module Google
|
|
999
1057
|
end
|
1000
1058
|
|
1001
1059
|
requests = formatted_images.map do |img|
|
1002
|
-
{
|
1060
|
+
request = {
|
1003
1061
|
image: img,
|
1004
1062
|
features: [feature]
|
1005
1063
|
}
|
1064
|
+
request[:image_context] = image_context if image_context
|
1065
|
+
request
|
1006
1066
|
end
|
1007
1067
|
|
1008
1068
|
if async
|
@@ -1050,6 +1110,44 @@ module Google
|
|
1050
1110
|
formatted_image
|
1051
1111
|
end
|
1052
1112
|
end
|
1113
|
+
|
1114
|
+
class ProductSearchClient
|
1115
|
+
# Alias for Google::Cloud::Vision::V1p3beta1::ProductSearchClient.location_path.
|
1116
|
+
# @param project [String]
|
1117
|
+
# @param location [String]
|
1118
|
+
# @return [String]
|
1119
|
+
def location_path project, location
|
1120
|
+
self.class.location_path project, location
|
1121
|
+
end
|
1122
|
+
|
1123
|
+
# Alias for Google::Cloud::Vision::V1p3beta1::ProductSearchClient.product_set_path.
|
1124
|
+
# @param project [String]
|
1125
|
+
# @param location [String]
|
1126
|
+
# @param product_set [String]
|
1127
|
+
# @return [String]
|
1128
|
+
def product_set_path project, location, product_set
|
1129
|
+
self.class.product_set_path project, location, product_set
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
# Alias for Google::Cloud::Vision::V1p3beta1::ProductSearchClient.product_path.
|
1133
|
+
# @param project [String]
|
1134
|
+
# @param location [String]
|
1135
|
+
# @param product [String]
|
1136
|
+
# @return [String]
|
1137
|
+
def product_path project, location, product
|
1138
|
+
self.class.product_path project, location, product
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
# Alias for Google::Cloud::Vision::V1p3beta1::ProductSearchClient.reference_image_path.
|
1142
|
+
# @param project [String]
|
1143
|
+
# @param location [String]
|
1144
|
+
# @param product [String]
|
1145
|
+
# @param reference_image [String]
|
1146
|
+
# @return [String]
|
1147
|
+
def reference_image_path project, location, product, reference_image
|
1148
|
+
self.class.reference_image_path project, location, product, reference_image
|
1149
|
+
end
|
1150
|
+
end
|
1053
1151
|
end
|
1054
1152
|
end
|
1055
1153
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-vision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.32.
|
4
|
+
version: 0.32.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-gax
|