Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dbaae4e

Browse filesBrowse files
authored
Add video region tags (GoogleCloudPlatform#1489)
1 parent 8591ad2 commit dbaae4e
Copy full SHA for dbaae4e

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed

‎video/cloud-client/analyze/analyze.py

Copy file name to clipboardExpand all lines: video/cloud-client/analyze/analyze.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434

3535
def analyze_explicit_content(path):
36+
# [START video_analyze_explicit_content]
3637
""" Detects explicit content from the GCS path to a video. """
3738
video_client = videointelligence.VideoIntelligenceServiceClient()
3839
features = [videointelligence.enums.Feature.EXPLICIT_CONTENT_DETECTION]
@@ -52,9 +53,11 @@ def analyze_explicit_content(path):
5253
print('Time: {}s'.format(frame_time))
5354
print('\tpornography: {}'.format(
5455
likely_string[frame.pornography_likelihood]))
56+
# [END video_analyze_explicit_content]
5557

5658

5759
def analyze_labels(path):
60+
# [START video_analyze_labels_gcs]
5861
""" Detects labels given a GCS path. """
5962
video_client = videointelligence.VideoIntelligenceServiceClient()
6063
features = [videointelligence.enums.Feature.LABEL_DETECTION]
@@ -129,9 +132,11 @@ def analyze_labels(path):
129132
print('\tFirst frame time offset: {}s'.format(time_offset))
130133
print('\tFirst frame confidence: {}'.format(frame.confidence))
131134
print('\n')
135+
# [END video_analyze_labels_gcs]
132136

133137

134138
def analyze_labels_file(path):
139+
# [START video_analyze_labels_local]
135140
"""Detect labels given a file path."""
136141
video_client = videointelligence.VideoIntelligenceServiceClient()
137142
features = [videointelligence.enums.Feature.LABEL_DETECTION]
@@ -202,9 +207,11 @@ def analyze_labels_file(path):
202207
print('\tFirst frame time offset: {}s'.format(time_offset))
203208
print('\tFirst frame confidence: {}'.format(frame.confidence))
204209
print('\n')
210+
# [END video_analyze_labels_local]
205211

206212

207213
def analyze_shots(path):
214+
# [START video_analyze_shots]
208215
""" Detects camera shot changes. """
209216
video_client = videointelligence.VideoIntelligenceServiceClient()
210217
features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION]
@@ -221,6 +228,7 @@ def analyze_shots(path):
221228
end_time = (shot.end_time_offset.seconds +
222229
shot.end_time_offset.nanos / 1e9)
223230
print('\tShot {}: {} to {}'.format(i, start_time, end_time))
231+
# [END video_analyze_shots]
224232

225233

226234
if __name__ == '__main__':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.