Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch authored and danoscarmike committed Sep 30, 2020
1 parent af202da commit 0cedabb
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@


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


def analyze_labels(path):
# [START video_analyze_labels_gcs]
""" Detects labels given a GCS path. """
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.enums.Feature.LABEL_DETECTION]
Expand Down Expand Up @@ -129,9 +132,11 @@ def analyze_labels(path):
print('\tFirst frame time offset: {}s'.format(time_offset))
print('\tFirst frame confidence: {}'.format(frame.confidence))
print('\n')
# [END video_analyze_labels_gcs]


def analyze_labels_file(path):
# [START video_analyze_labels_local]
"""Detect labels given a file path."""
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.enums.Feature.LABEL_DETECTION]
Expand Down Expand Up @@ -202,9 +207,11 @@ def analyze_labels_file(path):
print('\tFirst frame time offset: {}s'.format(time_offset))
print('\tFirst frame confidence: {}'.format(frame.confidence))
print('\n')
# [END video_analyze_labels_local]


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


if __name__ == '__main__':
Expand Down

0 comments on commit 0cedabb

Please sign in to comment.