Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update vision folder. #999

Merged
merged 6 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions vision/cloud-client/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Image Feature Detection Sample

<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[Google Cloud Vision API][vision] provides feature detection for images.
This API is part of the larger collection of Cloud Machine Learning APIs.

Expand Down
12 changes: 7 additions & 5 deletions vision/cloud-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
<artifactId>vision-google-cloud-samples</artifactId>
<packaging>jar</packaging>

<!-- Parent defines config for testing & linting. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<artifactId>doc-samples</artifactId>
<groupId>com.google.cloud</groupId>
<version>1.0.0</version>
<relativePath>../..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
31 changes: 16 additions & 15 deletions vision/cloud-client/src/main/java/com/example/vision/Detect.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
Copyright 2017, Google, Inc.
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.example.vision;

Expand Down Expand Up @@ -43,7 +44,6 @@
import com.google.cloud.vision.v1.WebDetection.WebPage;
import com.google.cloud.vision.v1.Word;
import com.google.protobuf.ByteString;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -805,7 +805,8 @@ public static void detectWebDetections(String filePath, PrintStream out) throws
}

/**
* Detects whether the specified remote image on Google Cloud Storage has features you would want to moderate.
* Detects whether the specified remote image on Google Cloud Storage has features you would want
* to moderate.
*
* @param gcsPath The path to the remote file on Google Cloud Storage to detect safe-search on.
* @param out A {@link PrintStream} to write the results to.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
/*
Copyright 2017, Google, Inc.
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.example.vision;

// [START vision_quickstart]
// Imports the Google Cloud client library

import com.google.cloud.vision.v1.AnnotateImageRequest;
import com.google.cloud.vision.v1.AnnotateImageResponse;
import com.google.cloud.vision.v1.BatchAnnotateImagesResponse;
Expand All @@ -27,7 +29,6 @@
import com.google.cloud.vision.v1.Image;
import com.google.cloud.vision.v1.ImageAnnotatorClient;
import com.google.protobuf.ByteString;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -68,7 +69,7 @@ public static void main(String... args) throws Exception {
}

for (EntityAnnotation annotation : res.getLabelAnnotationsList()) {
annotation.getAllFields().forEach((k, v)->
annotation.getAllFields().forEach((k, v) ->
System.out.printf("%s : %s\n", k, v.toString()));
}
}
Expand Down
35 changes: 17 additions & 18 deletions vision/cloud-client/src/test/java/com/example/vision/DetectIT.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
/*
Copyright 2017, Google, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

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

package com.example.vision;

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

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

/** Tests for vision "Detect" sample. */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
Expand Down
3 changes: 3 additions & 0 deletions vision/face-detection/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Google Cloud Vision API Java Face Detection example

<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

## Download Maven

This sample uses the [Apache Maven][maven] build system. Before getting started, be
Expand Down
12 changes: 7 additions & 5 deletions vision/face-detection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
<groupId>com.google.cloud.vision.samples</groupId>
<artifactId>vision-face-detection</artifactId>

<!-- Parent defines shared plugins for linting and unit testing. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
<version>1.0.0</version>
<relativePath>../..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.vision.samples.facedetect;

// [BEGIN import_libraries]

import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.json.JsonFactory;
Expand All @@ -32,7 +33,6 @@
import com.google.api.services.vision.v1.model.Image;
import com.google.api.services.vision.v1.model.Vertex;
import com.google.common.collect.ImmutableList;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
Expand All @@ -44,7 +44,6 @@
import java.nio.file.Paths;
import java.security.GeneralSecurityException;
import java.util.List;

import javax.imageio.ImageIO;
// [END import_libraries]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
import static org.junit.Assert.fail;

import com.google.api.services.vision.v1.model.FaceAnnotation;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;

/**
* Integration (system) tests for {@link FaceDetectApp}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import com.google.api.services.vision.v1.model.FaceAnnotation;
import com.google.api.services.vision.v1.model.Vertex;
import com.google.common.collect.ImmutableList;

import java.awt.image.BufferedImage;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.awt.image.BufferedImage;

/**
* Unit tests for {@link FaceDetectApp}.
*/
Expand Down
3 changes: 3 additions & 0 deletions vision/label/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Google Cloud Vision API Java Image Labeling example

<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

## Download Maven

This sample uses the [Apache Maven][maven] build system. Before getting started, be
Expand Down
12 changes: 7 additions & 5 deletions vision/label/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
<groupId>com.google.cloud.vision.samples</groupId>
<artifactId>vision-label</artifactId>

<!-- Parent defines shared plugins for linting and unit testing. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
<version>1.0.0</version>
<relativePath>../..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.cloud.vision.samples.label;

// [START import_libraries]

import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.json.JsonFactory;
Expand All @@ -31,7 +32,6 @@
import com.google.api.services.vision.v1.model.Feature;
import com.google.api.services.vision.v1.model.Image;
import com.google.common.collect.ImmutableList;

import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@

import com.google.api.services.vision.v1.model.EntityAnnotation;
import com.google.common.collect.ImmutableSet;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;

/**
* Integration (system) tests for {@link LabelApp}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@

import com.google.api.services.vision.v1.model.EntityAnnotation;
import com.google.common.collect.ImmutableList;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.nio.file.Paths;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
* Unit tests for {@link LabelApp}.
Expand Down
3 changes: 3 additions & 0 deletions vision/landmark-detection/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Google Cloud Vision API Java Landmark Detection example

<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">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

This sample takes in the URI for an object in Google Cloud Storage, and
identifies the landmark pictured in it.

Expand Down
12 changes: 7 additions & 5 deletions vision/landmark-detection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
<groupId>com.google.cloud.vision.samples</groupId>
<artifactId>vision-landmark-detection</artifactId>

<!-- Parent defines shared plugins for linting and unit testing. -->
<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
<version>1.0.0</version>
<relativePath>../..</relativePath>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.8</version>
</parent>

<properties>
Expand Down
Loading