@@ -201,6 +201,7 @@ public static void argsHelper(String[] args, PrintStream out) throws Exception,
201
201
* @throws Exception on errors while closing the client.
202
202
* @throws IOException on Input/Output errors.
203
203
*/
204
+ // [START vision_face_detection]
204
205
public static void detectFaces (String filePath , PrintStream out ) throws Exception , IOException {
205
206
List <AnnotateImageRequest > requests = new ArrayList <>();
206
207
@@ -234,6 +235,7 @@ public static void detectFaces(String filePath, PrintStream out) throws Exceptio
234
235
}
235
236
}
236
237
}
238
+ // [END vision_face_detection]
237
239
238
240
/**
239
241
* Detects faces in the specified remote image on Google Cloud Storage.
@@ -244,6 +246,7 @@ public static void detectFaces(String filePath, PrintStream out) throws Exceptio
244
246
* @throws Exception on errors while closing the client.
245
247
* @throws IOException on Input/Output errors.
246
248
*/
249
+ // [START vision_face_detection_gcs]
247
250
public static void detectFacesGcs (String gcsPath , PrintStream out ) throws Exception ,
248
251
IOException {
249
252
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -278,6 +281,7 @@ public static void detectFacesGcs(String gcsPath, PrintStream out) throws Except
278
281
}
279
282
}
280
283
}
284
+ // [END vision_face_detection_gcs]
281
285
282
286
/**
283
287
* Detects labels in the specified local image.
@@ -287,6 +291,7 @@ public static void detectFacesGcs(String gcsPath, PrintStream out) throws Except
287
291
* @throws Exception on errors while closing the client.
288
292
* @throws IOException on Input/Output errors.
289
293
*/
294
+ // [START vision_label_detection]
290
295
public static void detectLabels (String filePath , PrintStream out ) throws Exception , IOException {
291
296
List <AnnotateImageRequest > requests = new ArrayList <>();
292
297
@@ -315,6 +320,7 @@ public static void detectLabels(String filePath, PrintStream out) throws Excepti
315
320
}
316
321
}
317
322
}
323
+ // [END vision_label_detection]
318
324
319
325
/**
320
326
* Detects labels in the specified remote image on Google Cloud Storage.
@@ -325,6 +331,7 @@ public static void detectLabels(String filePath, PrintStream out) throws Excepti
325
331
* @throws Exception on errors while closing the client.
326
332
* @throws IOException on Input/Output errors.
327
333
*/
334
+ // [START vision_label_detection_gcs]
328
335
public static void detectLabelsGcs (String gcsPath , PrintStream out ) throws Exception ,
329
336
IOException {
330
337
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -354,6 +361,7 @@ public static void detectLabelsGcs(String gcsPath, PrintStream out) throws Excep
354
361
}
355
362
}
356
363
}
364
+ // [END vision_label_detection_gcs]
357
365
358
366
/**
359
367
* Detects landmarks in the specified local image.
@@ -363,6 +371,7 @@ public static void detectLabelsGcs(String gcsPath, PrintStream out) throws Excep
363
371
* @throws Exception on errors while closing the client.
364
372
* @throws IOException on Input/Output errors.
365
373
*/
374
+ // [START vision_landmark_detection]
366
375
public static void detectLandmarks (String filePath , PrintStream out ) throws Exception ,
367
376
IOException {
368
377
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -392,6 +401,7 @@ public static void detectLandmarks(String filePath, PrintStream out) throws Exce
392
401
}
393
402
}
394
403
}
404
+ // [END vision_landmark_detection]
395
405
396
406
/**
397
407
* Detects landmarks in the specified URI.
@@ -440,6 +450,7 @@ public static void detectLandmarksUrl(String uri, PrintStream out) throws Except
440
450
* @throws Exception on errors while closing the client.
441
451
* @throws IOException on Input/Output errors.
442
452
*/
453
+ // [START vision_landmark_detection_gcs]
443
454
public static void detectLandmarksGcs (String gcsPath , PrintStream out ) throws Exception ,
444
455
IOException {
445
456
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -469,6 +480,7 @@ public static void detectLandmarksGcs(String gcsPath, PrintStream out) throws Ex
469
480
}
470
481
}
471
482
}
483
+ // [END vision_landmark_detection_gcs]
472
484
473
485
/**
474
486
* Detects logos in the specified local image.
@@ -478,6 +490,7 @@ public static void detectLandmarksGcs(String gcsPath, PrintStream out) throws Ex
478
490
* @throws Exception on errors while closing the client.
479
491
* @throws IOException on Input/Output errors.
480
492
*/
493
+ // [START vision_logo_detection]
481
494
public static void detectLogos (String filePath , PrintStream out ) throws Exception , IOException {
482
495
List <AnnotateImageRequest > requests = new ArrayList <>();
483
496
@@ -506,6 +519,7 @@ public static void detectLogos(String filePath, PrintStream out) throws Exceptio
506
519
}
507
520
}
508
521
}
522
+ // [END vision_logo_detection]
509
523
510
524
/**
511
525
* Detects logos in the specified remote image on Google Cloud Storage.
@@ -516,6 +530,7 @@ public static void detectLogos(String filePath, PrintStream out) throws Exceptio
516
530
* @throws Exception on errors while closing the client.
517
531
* @throws IOException on Input/Output errors.
518
532
*/
533
+ // [START vision_logo_detection_gcs]
519
534
public static void detectLogosGcs (String gcsPath , PrintStream out ) throws Exception ,
520
535
IOException {
521
536
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -544,6 +559,7 @@ public static void detectLogosGcs(String gcsPath, PrintStream out) throws Except
544
559
}
545
560
}
546
561
}
562
+ // [END vision_logo_detection_gcs]
547
563
548
564
/**
549
565
* Detects text in the specified image.
@@ -553,6 +569,7 @@ public static void detectLogosGcs(String gcsPath, PrintStream out) throws Except
553
569
* @throws Exception on errors while closing the client.
554
570
* @throws IOException on Input/Output errors.
555
571
*/
572
+ // [START vision_text_detection]
556
573
public static void detectText (String filePath , PrintStream out ) throws Exception , IOException {
557
574
List <AnnotateImageRequest > requests = new ArrayList <>();
558
575
@@ -582,6 +599,7 @@ public static void detectText(String filePath, PrintStream out) throws Exception
582
599
}
583
600
}
584
601
}
602
+ // [END vision_text_detection]
585
603
586
604
/**
587
605
* Detects text in the specified remote image on Google Cloud Storage.
@@ -591,6 +609,7 @@ public static void detectText(String filePath, PrintStream out) throws Exception
591
609
* @throws Exception on errors while closing the client.
592
610
* @throws IOException on Input/Output errors.
593
611
*/
612
+ // [START vision_text_detection_gcs]
594
613
public static void detectTextGcs (String gcsPath , PrintStream out ) throws Exception , IOException {
595
614
List <AnnotateImageRequest > requests = new ArrayList <>();
596
615
@@ -619,6 +638,7 @@ public static void detectTextGcs(String gcsPath, PrintStream out) throws Excepti
619
638
}
620
639
}
621
640
}
641
+ // [END vision_text_detection_gcs]
622
642
623
643
/**
624
644
* Detects image properties such as color frequency from the specified local image.
@@ -628,6 +648,7 @@ public static void detectTextGcs(String gcsPath, PrintStream out) throws Excepti
628
648
* @throws Exception on errors while closing the client.
629
649
* @throws IOException on Input/Output errors.
630
650
*/
651
+ // [START vision_image_property_detection]
631
652
public static void detectProperties (String filePath , PrintStream out ) throws Exception ,
632
653
IOException {
633
654
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -663,6 +684,7 @@ public static void detectProperties(String filePath, PrintStream out) throws Exc
663
684
}
664
685
}
665
686
}
687
+ // [END vision_image_property_detection]
666
688
667
689
/**
668
690
* Detects image properties such as color frequency from the specified remote image on Google
@@ -673,6 +695,7 @@ public static void detectProperties(String filePath, PrintStream out) throws Exc
673
695
* @throws Exception on errors while closing the client.
674
696
* @throws IOException on Input/Output errors.
675
697
*/
698
+ // [START vision_image_property_detection_gcs]
676
699
public static void detectPropertiesGcs (String gcsPath , PrintStream out ) throws Exception ,
677
700
IOException {
678
701
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -707,8 +730,8 @@ public static void detectPropertiesGcs(String gcsPath, PrintStream out) throws E
707
730
}
708
731
}
709
732
}
733
+ // [END vision_image_property_detection_gcs]
710
734
711
- // [START vision_detect_safe_search]
712
735
/**
713
736
* Detects whether the specified image has features you would want to moderate.
714
737
*
@@ -717,6 +740,7 @@ public static void detectPropertiesGcs(String gcsPath, PrintStream out) throws E
717
740
* @throws Exception on errors while closing the client.
718
741
* @throws IOException on Input/Output errors.
719
742
*/
743
+ // [START vision_safe_search_detection]
720
744
public static void detectSafeSearch (String filePath , PrintStream out ) throws Exception ,
721
745
IOException {
722
746
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -751,9 +775,8 @@ public static void detectSafeSearch(String filePath, PrintStream out) throws Exc
751
775
}
752
776
}
753
777
}
754
- // [END vision_detect_safe_search ]
778
+ // [END vision_safe_search_detection ]
755
779
756
- // [START vision_detect_safe_search_uri]
757
780
/**
758
781
* Detects whether the specified image on Google Cloud Storage has features you would want
759
782
* to moderate.
@@ -763,6 +786,7 @@ public static void detectSafeSearch(String filePath, PrintStream out) throws Exc
763
786
* @throws Exception on errors while closing the client.
764
787
* @throws IOException on Input/Output errors.
765
788
*/
789
+ // [START vision_safe_search_detection_gcs]
766
790
public static void detectSafeSearchGcs (String gcsPath , PrintStream out ) throws Exception ,
767
791
IOException {
768
792
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -796,9 +820,9 @@ public static void detectSafeSearchGcs(String gcsPath, PrintStream out) throws E
796
820
}
797
821
}
798
822
}
799
- // [END vision_detect_safe_search_uri ]
823
+ // [END vision_safe_search_detection_gcs ]
800
824
801
- // [START vision_detect_web ]
825
+ // [START vision_web_detection ]
802
826
/**
803
827
* Finds references to the specified image on the web.
804
828
*
@@ -861,9 +885,9 @@ public static void detectWebDetections(String filePath, PrintStream out) throws
861
885
}
862
886
}
863
887
}
864
- // [END vision_detect_web ]
888
+ // [END vision_web_detection ]
865
889
866
- // [START vision_detect_web_uri ]
890
+ // [START vision_web_detection_gcs ]
867
891
/**
868
892
* Detects whether the remote image on Google Cloud Storage has features you would want to
869
893
* moderate.
@@ -926,7 +950,7 @@ public static void detectWebDetectionsGcs(String gcsPath, PrintStream out) throw
926
950
}
927
951
}
928
952
}
929
- // [END vision_detect_web_uri ]
953
+ // [END vision_web_detection_gcs ]
930
954
931
955
/**
932
956
* Find web entities given a local image.
@@ -1001,7 +1025,7 @@ public static void detectWebEntitiesGcs(String gcsPath, PrintStream out) throws
1001
1025
}
1002
1026
}
1003
1027
1004
- // [START vision_web_entities_include_geo_results ]
1028
+ // [START vision_web_detection_include_geo ]
1005
1029
/**
1006
1030
* Find web entities given a local image.
1007
1031
* @param filePath The path of the image to detect.
@@ -1048,9 +1072,9 @@ public static void detectWebEntitiesIncludeGeoResults(String filePath, PrintStre
1048
1072
}));
1049
1073
}
1050
1074
}
1051
- // [END vision_web_entities_include_geo_results ]
1075
+ // [END vision_web_detection_include_geo ]
1052
1076
1053
- // [START vision_web_entities_include_geo_results_uri ]
1077
+ // [START vision_web_detection_include_geo_gcs ]
1054
1078
/**
1055
1079
* Find web entities given the remote image on Google Cloud Storage.
1056
1080
* @param gcsPath The path to the remote file on Google Cloud Storage to detect web entities with
@@ -1099,7 +1123,7 @@ public static void detectWebEntitiesIncludeGeoResultsGcs(String gcsPath, PrintSt
1099
1123
}));
1100
1124
}
1101
1125
}
1102
- // [END vision_web_entities_include_geo_results_uri ]
1126
+ // [END vision_web_detection_include_geo_gcs ]
1103
1127
1104
1128
/**
1105
1129
* Suggests a region to crop to for a local file.
@@ -1109,6 +1133,7 @@ public static void detectWebEntitiesIncludeGeoResultsGcs(String gcsPath, PrintSt
1109
1133
* @throws Exception on errors while closing the client.
1110
1134
* @throws IOException on Input/Output errors.
1111
1135
*/
1136
+ // [START vision_crop_hint_detection]
1112
1137
public static void detectCropHints (String filePath , PrintStream out ) throws Exception ,
1113
1138
IOException {
1114
1139
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -1139,6 +1164,7 @@ public static void detectCropHints(String filePath, PrintStream out) throws Exce
1139
1164
}
1140
1165
}
1141
1166
}
1167
+ // [END vision_crop_hint_detection]
1142
1168
1143
1169
/**
1144
1170
* Suggests a region to crop to for a remote file on Google Cloud Storage.
@@ -1148,6 +1174,7 @@ public static void detectCropHints(String filePath, PrintStream out) throws Exce
1148
1174
* @throws Exception on errors while closing the client.
1149
1175
* @throws IOException on Input/Output errors.
1150
1176
*/
1177
+ // [START vision_crop_hint_detection_gcs]
1151
1178
public static void detectCropHintsGcs (String gcsPath , PrintStream out ) throws Exception ,
1152
1179
IOException {
1153
1180
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -1177,8 +1204,8 @@ public static void detectCropHintsGcs(String gcsPath, PrintStream out) throws Ex
1177
1204
}
1178
1205
}
1179
1206
}
1207
+ // [END vision_crop_hint_detection_gcs]
1180
1208
1181
- // [START vision_detect_document]
1182
1209
/**
1183
1210
* Performs document text detection on a local image file.
1184
1211
*
@@ -1187,8 +1214,9 @@ public static void detectCropHintsGcs(String gcsPath, PrintStream out) throws Ex
1187
1214
* @throws Exception on errors while closing the client.
1188
1215
* @throws IOException on Input/Output errors.
1189
1216
*/
1217
+ // [START vision_fulltext_detection]
1190
1218
public static void detectDocumentText (String filePath , PrintStream out ) throws Exception ,
1191
- IOException {
1219
+ IOException {
1192
1220
List <AnnotateImageRequest > requests = new ArrayList <>();
1193
1221
1194
1222
ByteString imgBytes = ByteString .readFrom (new FileInputStream (filePath ));
@@ -1241,9 +1269,8 @@ public static void detectDocumentText(String filePath, PrintStream out) throws E
1241
1269
}
1242
1270
}
1243
1271
}
1244
- // [END vision_detect_document ]
1272
+ // [END vision_fulltext_detection ]
1245
1273
1246
- // [START vision_detect_document_uri]
1247
1274
/**
1248
1275
* Performs document text detection on a remote image on Google Cloud Storage.
1249
1276
*
@@ -1252,6 +1279,7 @@ public static void detectDocumentText(String filePath, PrintStream out) throws E
1252
1279
* @throws Exception on errors while closing the client.
1253
1280
* @throws IOException on Input/Output errors.
1254
1281
*/
1282
+ // [START vision_fulltext_detection_gcs]
1255
1283
public static void detectDocumentTextGcs (String gcsPath , PrintStream out ) throws Exception ,
1256
1284
IOException {
1257
1285
List <AnnotateImageRequest > requests = new ArrayList <>();
@@ -1304,9 +1332,9 @@ public static void detectDocumentTextGcs(String gcsPath, PrintStream out) throws
1304
1332
}
1305
1333
}
1306
1334
}
1307
- // [END vision_detect_document_uri ]
1335
+ // [END vision_fulltext_detection_gcs ]
1308
1336
1309
- // [START vision_async_detect_document_ocr ]
1337
+ // [START vision_text_detection_pdf_gcs ]
1310
1338
/**
1311
1339
* Performs document text OCR with PDF/TIFF as source files on Google Cloud Storage.
1312
1340
*
@@ -1423,5 +1451,5 @@ public static void detectDocumentsGcs(String gcsSourcePath, String gcsDestinatio
1423
1451
}
1424
1452
}
1425
1453
}
1426
- // [END vision_async_detect_document_ocr ]
1454
+ // [END vision_text_detection_pdf_gcs ]
1427
1455
}
0 commit comments