Skip to content

Commit 40c51ed

Browse files
authored
Vision v1p1beta1 samples (#951)
* Copy initial files over to v1p1beta1 directory * Add Java vision v1p1beta1 samples * Update beta/ cloud-client/ directories * Update README
1 parent 23a9b03 commit 40c51ed

File tree

15 files changed

+1967
-83
lines changed

15 files changed

+1967
-83
lines changed

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191

9292
<module>unittests</module>
9393
<module>video/cloud-client</module>
94+
<module>vision/beta/cloud-client</module>
9495
<module>vision/cloud-client</module>
9596
<module>vision/face-detection</module>
9697
<module>vision/label</module>

vision/beta/cloud-client/README.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Image Feature Detection Sample
2+
3+
[Google Cloud Vision API][vision] provides feature detection for images.
4+
This API is part of the larger collection of Cloud Machine Learning APIs.
5+
6+
This sample Java application demonstrates how to access the Cloud Vision API
7+
using the [Google Cloud Client Library for Java][google-cloud-java].
8+
9+
[vision]: https://cloud.google.com/vision/docs/
10+
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
11+
12+
## Build the sample
13+
14+
Install [Maven](http://maven.apache.org/).
15+
16+
Build your project with:
17+
18+
```
19+
mvn clean package
20+
```
21+
22+
You can then run `Detect` via:
23+
24+
```
25+
mvn exec:java -DDetect -Dexec.args="arg1 'arg 2' arg3"
26+
```
27+
28+
### Analyze an image
29+
30+
```
31+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
32+
```
33+
34+
#### Faces
35+
```
36+
mvn exec:java -DDetect -Dexec.args="faces ./resources/face_no_surprise.jpg"
37+
```
38+
39+
#### Labels
40+
```
41+
mvn exec:java -DDetect -Dexec.args="labels ./resources/wakeupcat.jpg"
42+
```
43+
44+
#### Landmarks
45+
```
46+
mvn exec:java -DDetect -Dexec.args="landmarks ./resources/landmark.jpg"
47+
```
48+
49+
#### Logos
50+
```
51+
mvn exec:java -DDetect -Dexec.args="logos ./resources/logos.png"
52+
```
53+
54+
#### Text
55+
```
56+
mvn exec:java -DDetect -Dexec.args="text ./resources/text.jpg"
57+
```
58+
59+
#### Safe Search
60+
```
61+
mvn exec:java -DDetect -Dexec.args="safe-search ./resources/wakeupcat.jpg"
62+
```
63+
64+
#### Properties
65+
```
66+
mvn exec:java -DDetect -Dexec.args="properties ./resources/city.jpg"
67+
```
68+
69+
#### Web
70+
```
71+
mvn exec:java -DDetect -Dexec.args="web ./resources/landmark.jpg"
72+
```
73+
74+
#### Web Entities
75+
```
76+
mvn exec:java -DDetect -Dexec.args="web-entities ./resources/landmark.jpg"
77+
```
78+
79+
#### Web Entities Include Geo
80+
```
81+
mvn exec:java -DDetect -Dexec.args="web-entities-include-geo ./resources/landmark.jpg"
82+
```
83+
84+
#### Crop
85+
```
86+
mvn exec:java -DDetect -Dexec.args="crop ./resources/landmark.jpg"
87+
```

vision/beta/cloud-client/pom.xml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!--
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+
-->
16+
<project>
17+
<modelVersion>4.0.0</modelVersion>
18+
<groupId>com.example.vision</groupId>
19+
<artifactId>vision-detect-beta</artifactId>
20+
<packaging>jar</packaging>
21+
22+
<!-- Parent defines config for testing & linting. -->
23+
<parent>
24+
<artifactId>doc-samples</artifactId>
25+
<groupId>com.google.cloud</groupId>
26+
<version>1.0.0</version>
27+
<relativePath>../../..</relativePath>
28+
</parent>
29+
30+
<properties>
31+
<maven.compiler.target>1.8</maven.compiler.target>
32+
<maven.compiler.source>1.8</maven.compiler.source>
33+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34+
</properties>
35+
36+
<dependencies>
37+
<!-- [START dependencies] -->
38+
<dependency>
39+
<groupId>com.google.cloud</groupId>
40+
<artifactId>google-cloud-vision</artifactId>
41+
<version>1.14.0</version>
42+
</dependency>
43+
<!-- [END dependencies] -->
44+
45+
<!-- Test dependencies -->
46+
<dependency>
47+
<groupId>junit</groupId>
48+
<artifactId>junit</artifactId>
49+
<version>4.12</version>
50+
<scope>test</scope>
51+
</dependency>
52+
53+
<dependency>
54+
<groupId>com.google.truth</groupId>
55+
<artifactId>truth</artifactId>
56+
<version>0.36</version>
57+
<scope>test</scope>
58+
</dependency>
59+
</dependencies>
60+
61+
<profiles>
62+
<profile>
63+
<id>Detect</id>
64+
<activation>
65+
<property>
66+
<name>Detect</name>
67+
</property>
68+
</activation>
69+
<build>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.codehaus.mojo</groupId>
73+
<artifactId>exec-maven-plugin</artifactId>
74+
<version>1.6.0</version>
75+
<executions>
76+
<execution>
77+
<goals>
78+
<goal>java</goal>
79+
</goals>
80+
</execution>
81+
</executions>
82+
<configuration>
83+
<mainClass>com.example.vision.Detect</mainClass>
84+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
85+
</configuration>
86+
</plugin>
87+
</plugins>
88+
</build>
89+
</profile>
90+
</profiles>
91+
</project>
3.5 MB
Loading
Loading
Loading
8.06 KB
Loading
122 KB
Loading
63.4 KB
Loading

0 commit comments

Comments
 (0)