Skip to content

Commit 6deaadc

Browse files
committed
Initial commit of sample
1 parent 783a454 commit 6deaadc

File tree

4 files changed

+605
-0
lines changed

4 files changed

+605
-0
lines changed

video/cloud-client/README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Image Feature Detection Sample
2+
3+
[Google Cloud Video Intelligence API][video] provides feature detection for
4+
images. This API is part of the larger collection of Cloud Machine Learning
5+
APIs.
6+
7+
This sample Java application demonstrates how to access the Cloud Video API
8+
using the [Google Cloud Client Library for Java][google-cloud-java].
9+
10+
[video]: https://cloud.google.com/video-intelligence/docs/
11+
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
12+
13+
## Build the sample
14+
15+
Install [Maven](http://maven.apache.org/).
16+
17+
Build your project with:
18+
19+
```
20+
mvn clean compile assembly:single
21+
```
22+
23+
### Analyze a video
24+
Please follow the [Set Up Your Project](https://cloud.google.com/video-intelligence/docs/getting-started#set_up_your_project)
25+
steps in the Quickstart doc to create a project and enable the Google Cloud
26+
Video Intelligence API. Following those steps, make sure that you
27+
[Set Up a Service Account](https://cloud.google.com/video-intelligence/docs/common/auth#set_up_a_service_account),
28+
and export the following environment variable:
29+
30+
```
31+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
32+
```
33+
34+
After you have authorized, you can analyze videos.
35+
36+
Detect Faces
37+
```
38+
java -cp target/video-google-cloud-samples-1.0.0-jar-with-dependencies.jar \
39+
com.example.video.Detect faces gs://demomaker/volleyball_court.mp4
40+
```
41+
42+
Detect Labels
43+
```
44+
java -cp target/video-google-cloud-samples-1.0.0-jar-with-dependencies.jar \
45+
com.example.video.Detect labels gs://demomaker/cat.mp4
46+
47+
java -cp target/video-google-cloud-samples-1.0.0-jar-with-dependencies.jar \
48+
com.example.video.Detect labels-file ./resources/cat.mp4
49+
```
50+
51+
Detect Safe Search annotations
52+
```
53+
java -cp target/video-google-cloud-samples-1.0.0-jar-with-dependencies.jar \
54+
com.example.video.Detect safesearch gs://demomaker/cat.mp4
55+
```
56+
57+
Detect Shots
58+
```
59+
java -cp target/video-google-cloud-samples-1.0.0-jar-with-dependencies.jar \
60+
com.example.video.Detect shots gs://demomaker/gbikes_dinosaur.mp4
61+
```

video/cloud-client/pom.xml

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<!--
2+
Copyright 2017 Google Inc. All Rights Reserved.
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.video</groupId>
19+
<artifactId>video-google-cloud-samples</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.guava</groupId>
40+
<artifactId>guava</artifactId>
41+
<version>20.0</version>
42+
</dependency>
43+
<dependency>
44+
<groupId>com.google.cloud</groupId>
45+
<artifactId>google-cloud-videointelligence-grpc</artifactId>
46+
<version>0.1.1-0</version>
47+
<exclusions>
48+
<exclusion> <!-- exclude an old version of Guava -->
49+
<groupId>com.google.guava</groupId>
50+
<artifactId>guava-jdk5</artifactId>
51+
</exclusion>
52+
</exclusions>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.google.cloud</groupId>
56+
<artifactId>google-cloud-videointelligence-proto</artifactId>
57+
<version>0.1.1-0</version>
58+
<exclusions>
59+
<exclusion> <!-- exclude an old version of Guava -->
60+
<groupId>com.google.guava</groupId>
61+
<artifactId>guava-jdk5</artifactId>
62+
</exclusion>
63+
</exclusions>
64+
</dependency>
65+
<dependency>
66+
<groupId>com.google.cloud</groupId>
67+
<artifactId>google-cloud-videointelligence</artifactId>
68+
<version>0.1.1-0</version>
69+
<exclusions>
70+
<exclusion> <!-- exclude an old version of Guava -->
71+
<groupId>com.google.guava</groupId>
72+
<artifactId>guava-jdk5</artifactId>
73+
</exclusion>
74+
</exclusions>
75+
</dependency>
76+
<dependency>
77+
<groupId>com.google.api</groupId>
78+
<artifactId>gax</artifactId>
79+
<version>0.0.29</version>
80+
<exclusions>
81+
<exclusion> <!-- exclude an old version of Guava -->
82+
<groupId>com.google.guava</groupId>
83+
<artifactId>guava-jdk5</artifactId>
84+
</exclusion>
85+
</exclusions>
86+
</dependency>
87+
<dependency>
88+
<groupId>io.netty</groupId>
89+
<artifactId>netty-tcnative-boringssl-static</artifactId>
90+
<version>1.1.33.Fork19</version>
91+
</dependency>
92+
<!-- [END dependencies] -->
93+
94+
<!-- Test dependencies -->
95+
<dependency>
96+
<groupId>junit</groupId>
97+
<artifactId>junit</artifactId>
98+
<version>4.12</version>
99+
<scope>test</scope>
100+
</dependency>
101+
<dependency>
102+
<groupId>com.google.truth</groupId>
103+
<artifactId>truth</artifactId>
104+
<version>0.31</version>
105+
<scope>test</scope>
106+
</dependency>
107+
</dependencies>
108+
<build>
109+
<plugins>
110+
<plugin>
111+
<artifactId>maven-assembly-plugin</artifactId>
112+
<configuration>
113+
<archive>
114+
<manifest>
115+
<mainClass>com.example.video.Detect</mainClass>
116+
</manifest>
117+
</archive>
118+
<descriptorRefs>
119+
<descriptorRef>jar-with-dependencies</descriptorRef>
120+
</descriptorRefs>
121+
</configuration>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
</project>

0 commit comments

Comments
 (0)