Skip to content

Commit e0918ef

Browse files
authored
Update vision folder. (GoogleCloudPlatform#999)
* Update vision/cloud-client * Updated vision/face-detection. * Updated vision/label * Updated vision/landmark-detection * Updated vision/text * Fix checkstyle issues with landmarkdetection.
1 parent 398f9c3 commit e0918ef

File tree

26 files changed

+139
-136
lines changed

26 files changed

+139
-136
lines changed

vision/cloud-client/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Image Feature Detection Sample
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=vision/cloud-client/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
[Google Cloud Vision API][vision] provides feature detection for images.
47
This API is part of the larger collection of Cloud Machine Learning APIs.
58

vision/cloud-client/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
<artifactId>vision-google-cloud-samples</artifactId>
2020
<packaging>jar</packaging>
2121

22-
<!-- Parent defines config for testing & linting. -->
22+
<!--
23+
The parent pom defines common style checks and testing strategies for our samples.
24+
Removing or replacing it should not affect the execution of the samples in anyway.
25+
-->
2326
<parent>
24-
<artifactId>doc-samples</artifactId>
25-
<groupId>com.google.cloud</groupId>
26-
<version>1.0.0</version>
27-
<relativePath>../..</relativePath>
27+
<groupId>com.google.cloud.samples</groupId>
28+
<artifactId>shared-configuration</artifactId>
29+
<version>1.0.8</version>
2830
</parent>
2931

3032
<properties>

vision/cloud-client/src/main/java/com/example/vision/Detect.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/*
2-
Copyright 2017, Google, Inc.
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
316

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1617

1718
package com.example.vision;
1819

@@ -43,7 +44,6 @@
4344
import com.google.cloud.vision.v1.WebDetection.WebPage;
4445
import com.google.cloud.vision.v1.Word;
4546
import com.google.protobuf.ByteString;
46-
4747
import java.io.FileInputStream;
4848
import java.io.IOException;
4949
import java.io.PrintStream;
@@ -805,7 +805,8 @@ public static void detectWebDetections(String filePath, PrintStream out) throws
805805
}
806806

807807
/**
808-
* Detects whether the specified remote image on Google Cloud Storage has features you would want to moderate.
808+
* Detects whether the specified remote image on Google Cloud Storage has features you would want
809+
* to moderate.
809810
*
810811
* @param gcsPath The path to the remote file on Google Cloud Storage to detect safe-search on.
811812
* @param out A {@link PrintStream} to write the results to.

vision/cloud-client/src/main/java/com/example/vision/QuickstartSample.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
/*
2-
Copyright 2017, Google, Inc.
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
316

4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1617

1718
package com.example.vision;
1819

1920
// [START vision_quickstart]
2021
// Imports the Google Cloud client library
22+
2123
import com.google.cloud.vision.v1.AnnotateImageRequest;
2224
import com.google.cloud.vision.v1.AnnotateImageResponse;
2325
import com.google.cloud.vision.v1.BatchAnnotateImagesResponse;
@@ -27,7 +29,6 @@
2729
import com.google.cloud.vision.v1.Image;
2830
import com.google.cloud.vision.v1.ImageAnnotatorClient;
2931
import com.google.protobuf.ByteString;
30-
3132
import java.nio.file.Files;
3233
import java.nio.file.Path;
3334
import java.nio.file.Paths;
@@ -68,7 +69,7 @@ public static void main(String... args) throws Exception {
6869
}
6970

7071
for (EntityAnnotation annotation : res.getLabelAnnotationsList()) {
71-
annotation.getAllFields().forEach((k, v)->
72+
annotation.getAllFields().forEach((k, v) ->
7273
System.out.printf("%s : %s\n", k, v.toString()));
7374
}
7475
}

vision/cloud-client/src/test/java/com/example/vision/DetectIT.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
/*
2-
Copyright 2017, Google, Inc.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
2+
* Copyright 2017 Google Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.example.vision;
1818

1919
import static com.google.common.truth.Truth.assertThat;
2020

21+
import java.io.ByteArrayOutputStream;
22+
import java.io.IOException;
23+
import java.io.PrintStream;
2124
import org.junit.After;
2225
import org.junit.Before;
2326
import org.junit.Test;
2427
import org.junit.runner.RunWith;
2528
import org.junit.runners.JUnit4;
2629

27-
import java.io.ByteArrayOutputStream;
28-
import java.io.IOException;
29-
import java.io.PrintStream;
30-
3130
/** Tests for vision "Detect" sample. */
3231
@RunWith(JUnit4.class)
3332
@SuppressWarnings("checkstyle:abbreviationaswordinname")

vision/face-detection/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Google Cloud Vision API Java Face Detection example
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=vision/face-detection/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
## Download Maven
47

58
This sample uses the [Apache Maven][maven] build system. Before getting started, be

vision/face-detection/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
<groupId>com.google.cloud.vision.samples</groupId>
2222
<artifactId>vision-face-detection</artifactId>
2323

24-
<!-- Parent defines shared plugins for linting and unit testing. -->
24+
<!--
25+
The parent pom defines common style checks and testing strategies for our samples.
26+
Removing or replacing it should not affect the execution of the samples in anyway.
27+
-->
2528
<parent>
26-
<groupId>com.google.cloud</groupId>
27-
<artifactId>doc-samples</artifactId>
28-
<version>1.0.0</version>
29-
<relativePath>../..</relativePath>
29+
<groupId>com.google.cloud.samples</groupId>
30+
<artifactId>shared-configuration</artifactId>
31+
<version>1.0.8</version>
3032
</parent>
3133

3234
<properties>

vision/face-detection/src/main/java/com/google/cloud/vision/samples/facedetect/FaceDetectApp.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.cloud.vision.samples.facedetect;
1818

1919
// [BEGIN import_libraries]
20+
2021
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
2122
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
2223
import com.google.api.client.json.JsonFactory;
@@ -32,7 +33,6 @@
3233
import com.google.api.services.vision.v1.model.Image;
3334
import com.google.api.services.vision.v1.model.Vertex;
3435
import com.google.common.collect.ImmutableList;
35-
3636
import java.awt.BasicStroke;
3737
import java.awt.Color;
3838
import java.awt.Graphics2D;
@@ -44,7 +44,6 @@
4444
import java.nio.file.Paths;
4545
import java.security.GeneralSecurityException;
4646
import java.util.List;
47-
4847
import javax.imageio.ImageIO;
4948
// [END import_libraries]
5049

vision/face-detection/src/test/java/com/google/cloud/vision/samples/facedetect/FaceDetectAppIT.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
import static org.junit.Assert.fail;
2121

2222
import com.google.api.services.vision.v1.model.FaceAnnotation;
23-
23+
import java.io.IOException;
24+
import java.nio.file.Paths;
25+
import java.util.List;
2426
import org.junit.Before;
2527
import org.junit.Test;
2628
import org.junit.runner.RunWith;
2729
import org.junit.runners.JUnit4;
2830

29-
import java.io.IOException;
30-
import java.nio.file.Paths;
31-
import java.util.List;
32-
3331
/**
3432
* Integration (system) tests for {@link FaceDetectApp}.
3533
*/

vision/face-detection/src/test/java/com/google/cloud/vision/samples/facedetect/FaceDetectAppTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222
import com.google.api.services.vision.v1.model.FaceAnnotation;
2323
import com.google.api.services.vision.v1.model.Vertex;
2424
import com.google.common.collect.ImmutableList;
25-
25+
import java.awt.image.BufferedImage;
2626
import org.junit.Test;
2727
import org.junit.runner.RunWith;
2828
import org.junit.runners.JUnit4;
2929

30-
import java.awt.image.BufferedImage;
31-
3230
/**
3331
* Unit tests for {@link FaceDetectApp}.
3432
*/

vision/label/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Google Cloud Vision API Java Image Labeling example
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=vision/label/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
## Download Maven
47

58
This sample uses the [Apache Maven][maven] build system. Before getting started, be

vision/label/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
<groupId>com.google.cloud.vision.samples</groupId>
2222
<artifactId>vision-label</artifactId>
2323

24-
<!-- Parent defines shared plugins for linting and unit testing. -->
24+
<!--
25+
The parent pom defines common style checks and testing strategies for our samples.
26+
Removing or replacing it should not affect the execution of the samples in anyway.
27+
-->
2528
<parent>
26-
<groupId>com.google.cloud</groupId>
27-
<artifactId>doc-samples</artifactId>
28-
<version>1.0.0</version>
29-
<relativePath>../..</relativePath>
29+
<groupId>com.google.cloud.samples</groupId>
30+
<artifactId>shared-configuration</artifactId>
31+
<version>1.0.8</version>
3032
</parent>
3133

3234
<properties>

vision/label/src/main/java/com/google/cloud/vision/samples/label/LabelApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.cloud.vision.samples.label;
1818

1919
// [START import_libraries]
20+
2021
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
2122
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
2223
import com.google.api.client.json.JsonFactory;
@@ -31,7 +32,6 @@
3132
import com.google.api.services.vision.v1.model.Feature;
3233
import com.google.api.services.vision.v1.model.Image;
3334
import com.google.common.collect.ImmutableList;
34-
3535
import java.io.IOException;
3636
import java.io.PrintStream;
3737
import java.nio.file.Files;

vision/label/src/test/java/com/google/cloud/vision/samples/label/LabelAppIT.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@
2121

2222
import com.google.api.services.vision.v1.model.EntityAnnotation;
2323
import com.google.common.collect.ImmutableSet;
24-
24+
import java.io.IOException;
25+
import java.nio.file.Paths;
26+
import java.util.List;
2527
import org.junit.Before;
2628
import org.junit.Test;
2729
import org.junit.runner.RunWith;
2830
import org.junit.runners.JUnit4;
2931

30-
import java.io.IOException;
31-
import java.nio.file.Paths;
32-
import java.util.List;
33-
3432
/**
3533
* Integration (system) tests for {@link LabelApp}.
3634
*/

vision/label/src/test/java/com/google/cloud/vision/samples/label/LabelAppTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@
2020

2121
import com.google.api.services.vision.v1.model.EntityAnnotation;
2222
import com.google.common.collect.ImmutableList;
23-
24-
import org.junit.Test;
25-
import org.junit.runner.RunWith;
26-
import org.junit.runners.JUnit4;
27-
2823
import java.io.ByteArrayOutputStream;
2924
import java.io.PrintStream;
3025
import java.nio.file.Paths;
26+
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.JUnit4;
3129

3230
/**
3331
* Unit tests for {@link LabelApp}.

vision/landmark-detection/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Google Cloud Vision API Java Landmark Detection example
22

3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=vision/landmark-detection/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
36
This sample takes in the URI for an object in Google Cloud Storage, and
47
identifies the landmark pictured in it.
58

vision/landmark-detection/pom.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
<groupId>com.google.cloud.vision.samples</groupId>
2222
<artifactId>vision-landmark-detection</artifactId>
2323

24-
<!-- Parent defines shared plugins for linting and unit testing. -->
24+
<!--
25+
The parent pom defines common style checks and testing strategies for our samples.
26+
Removing or replacing it should not affect the execution of the samples in anyway.
27+
-->
2528
<parent>
26-
<groupId>com.google.cloud</groupId>
27-
<artifactId>doc-samples</artifactId>
28-
<version>1.0.0</version>
29-
<relativePath>../..</relativePath>
29+
<groupId>com.google.cloud.samples</groupId>
30+
<artifactId>shared-configuration</artifactId>
31+
<version>1.0.8</version>
3032
</parent>
3133

3234
<properties>

0 commit comments

Comments
 (0)