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

migrate code from googleapis/nodejs-video-intelligence #2855

Merged
merged 149 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
3a5e006
Video samples (#319)
Mar 8, 2017
ec2f5d4
Fix typo
Mar 8, 2017
5e9c13f
Fix typo
Mar 8, 2017
6ff83b2
Travis: fix failing tests + update dependencies (#335)
Apr 5, 2017
5960678
Bring ML APIs up to standard. (#346)
jmdobry Apr 12, 2017
fbeafac
Cleanup App Engine samples and re-work tests. (#354)
jmdobry Apr 24, 2017
c2e7837
Add video quickstart (#367)
May 1, 2017
bf50e37
Upgrade to repo tools v1.4.7 (#370)
jmdobry May 2, 2017
df1471b
Add new video samples (#382)
May 10, 2017
9dc4dfe
Address comments (#388)
May 18, 2017
89a7a80
Switch to faster videos + update print statements (#395)
May 18, 2017
4ac41b1
Add + run dependency updating (bash) script (#401)
Jun 19, 2017
a463814
Remove entire video from faces (#410)
Jul 7, 2017
d0c0195
Build updates. (#462)
jmdobry Aug 23, 2017
bb455fd
Video update (#476)
Sep 21, 2017
91ec24d
Repo Migration (#4)
lukesneeringer Oct 24, 2017
e18b315
Bump version to v0.4.0 (#5)
lukesneeringer Oct 24, 2017
877eb75
Upgrade repo-tools and regenerate scaffolding. (#8)
jmdobry Oct 30, 2017
8f61c9b
Prettify. (#11)
stephenplusplus Nov 7, 2017
074e8d9
Add the v1 (stable) endpoint. (#9)
lukesneeringer Nov 14, 2017
96ad0e7
Change <gcsUri> to <filePath> for labels-file command (#14)
Nov 30, 2017
5692dbc
chore: release 1.1.0 (#24)
alexander-fenster Mar 15, 2018
3ce6787
Upgrade repo-tools and regenerate scaffolding. (#25)
jmdobry Mar 16, 2018
54b9c21
Added Video Transcription sample code. (#30)
happyhuman Apr 9, 2018
35f5c8e
bump version to 1.2.0 (#32)
crwilcox Apr 11, 2018
1010dce
Removed the face detection sample code and the unit test (#33)
happyhuman Apr 26, 2018
abf39e1
chore: lock files maintenance (#34)
alexander-fenster May 2, 2018
d207d65
chore: lock files maintenance (#36)
alexander-fenster May 8, 2018
65bef09
Update sample region tags (#39)
beccasaurus May 21, 2018
6aefbe7
chore: lock files maintenance (#41)
alexander-fenster May 22, 2018
f5ea368
fix: update all dependencies (#44)
JustinBeckwith Jun 22, 2018
2ddc527
chore: update sample lockfiles (#49)
JustinBeckwith Jun 25, 2018
2fc45e0
fix: update linking for samples (#47)
JustinBeckwith Jun 26, 2018
30ee4ca
refactor: drop repo-tool as an exec wrapper (#50)
JustinBeckwith Jun 26, 2018
7ed493b
fix(deps): update dependency yargs to v12 (#53)
renovate[bot] Jun 28, 2018
3411faa
chore(deps): lock file maintenance (#54)
renovate[bot] Jul 3, 2018
7ab6a80
chore(deps): lock file maintenance (#56)
renovate[bot] Jul 10, 2018
8430529
chore(deps): lock file maintenance (#58)
renovate[bot] Jul 10, 2018
1f2d125
chore(deps): lock file maintenance (#59)
renovate[bot] Jul 10, 2018
cbda9f1
chore(deps): lock file maintenance (#63)
renovate[bot] Jul 17, 2018
c84eb93
chore(deps): lock file maintenance (#65)
renovate[bot] Jul 24, 2018
3d08831
chore: require node 8 for samples (#68)
JustinBeckwith Jul 30, 2018
f13b551
chore(deps): lock file maintenance (#69)
renovate[bot] Jul 31, 2018
4751f81
Enabling Auto Punctuation (#70)
happyhuman Jul 31, 2018
e9d60cb
chore(deps): lock file maintenance (#74)
renovate[bot] Aug 7, 2018
398e65a
chore: ignore package-lock.json (#76)
JustinBeckwith Aug 7, 2018
defe1cd
Video Intelligence region tag update (#81)
alixhami Aug 16, 2018
666868c
fix video transcription test (#89)
jkwlui Aug 30, 2018
3a8fc44
Update CircleCI config and version to v1.3.0 (#90)
jkwlui Aug 31, 2018
3dc2423
Release v1.4.0 (#99)
jkwlui Sep 17, 2018
84bf79b
Enable prefer-const in the eslint config (#102)
JustinBeckwith Sep 20, 2018
d45b450
Update CI config (#105)
dpebot Sep 27, 2018
8253c40
Release v1.4.1 (#113)
JustinBeckwith Oct 19, 2018
bb98cd4
docs(samples): video beta samples (#123)
nirupa-kumar Oct 25, 2018
055e980
Release v1.5.0 (#130)
JustinBeckwith Oct 29, 2018
e99701d
chore: remove unused deps and fix lint (#141)
JustinBeckwith Nov 9, 2018
092583b
chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 …
renovate[bot] Nov 10, 2018
4d64f0a
refactor(samples): convert sample tests from ava to mocha (#146)
nareshqlogic Nov 15, 2018
e728791
docs(samples): updated samples code to use async await (#151)
praveenqlogic Nov 22, 2018
8ae68d6
chore: update samples to use GA APIs (#153)
happyhuman Nov 27, 2018
f5dbf01
docs: fix typo in samples/analyze.js (#159)
leahecole Dec 5, 2018
f196ab9
refactor: modernize the sample tests (#173)
JustinBeckwith Dec 17, 2018
4c17952
Release v1.5.1 (#186)
JustinBeckwith Feb 6, 2019
fef5b4e
fix(deps): update dependency yargs to v13 (#192)
renovate[bot] Feb 14, 2019
c23d29c
chore(deps): update dependency mocha to v6
renovate[bot] Feb 19, 2019
922d61c
Release v1.6.0 (#199)
jkwlui Feb 21, 2019
bce0858
docs(samples): Object tracking and Text detection GA samples (#202)
nirupa-kumar Mar 1, 2019
01826fb
docs(samples): streaming beta samples (#210)
nirupa-kumar Mar 26, 2019
527274d
docs(samples): Adds start of region tag (#216)
telpirion Apr 1, 2019
88f4799
refactor: use execSync for tests (#217)
JustinBeckwith Apr 4, 2019
d5f2b9a
refactor: wrap execSync with encoding: utf-8 (#218)
jkwlui Apr 5, 2019
bb28fae
chore: release 2.0.0 (#235)
bcoe May 13, 2019
66c3e5a
chore: release 2.0.1 (#241)
yoshi-automation May 20, 2019
018dc3f
chore: release 2.1.0 (#250)
yoshi-automation Jun 5, 2019
01dbaaa
Fix typo in example command (#252)
leahecole Jun 10, 2019
814cf64
fix: Update example commands to use cloud-storage-samples bucket (#253)
leahecole Jun 10, 2019
5d11e43
chore: release 2.1.1 (#254)
yoshi-automation Jun 10, 2019
7226ba6
chore: release 2.1.2 (#258)
yoshi-automation Jun 14, 2019
58439ba
chore: release 2.2.0 (#262)
yoshi-automation Jun 20, 2019
cb9b587
chore: release 2.2.1 (#267)
yoshi-automation Jun 26, 2019
5a30527
chore: release 2.2.2 (#280)
yoshi-automation Aug 5, 2019
335b6c0
fix(deps): update dependency yargs to v14
renovate-bot Aug 20, 2019
40741c9
feat: add streaming automl classification samples (#284)
leahecole Sep 5, 2019
217c43f
fix: fixed typo enableAutomaticPunctuation2 in sample
codediodeio Sep 13, 2019
27e54f1
chore: release 2.3.0 (#285)
yoshi-automation Sep 16, 2019
aeee285
feat: .d.ts for protos (#293)
yoshi-automation Sep 30, 2019
1cf69b3
fix(tests): use alternate video for integration tests (#311)
bcoe Oct 23, 2019
de86339
chore: release 2.5.2 (#310)
release-please[bot] Oct 31, 2019
6f47f9c
chore: release 2.6.0 (#317)
release-please[bot] Nov 8, 2019
2faee87
chore: release 2.6.1 (#322)
release-please[bot] Nov 15, 2019
be3c00c
fix(deps): update dependency yargs to v15 (#326)
renovate-bot Nov 18, 2019
29a00be
chore: release 2.6.2 (#327)
release-please[bot] Nov 18, 2019
ade28d3
chore: update license headers (#329)
JustinBeckwith Nov 25, 2019
3ba734a
chore: release 2.6.3 (#335)
release-please[bot] Dec 5, 2019
517fe7f
refactor: use explicit mocha imports (#341)
JustinBeckwith Jan 3, 2020
894c4c9
chore: release 2.6.4 (#345)
release-please[bot] Jan 6, 2020
15172b7
chore(deps): update dependency mocha to v7 (#347)
renovate-bot Jan 6, 2020
0a0ad1d
chore: release 2.6.5 (#359)
release-please[bot] Jan 30, 2020
2670c0f
feat: face and person detection samples (#362)
telpirion Feb 7, 2020
c75eccd
fix: fixes face and people detection region tags (#367)
telpirion Feb 11, 2020
0d1d196
fix: adds spaces to region tags, other fixes (#369)
telpirion Feb 12, 2020
9802d17
fix: refactors person and face detection samples into separate files …
telpirion Feb 13, 2020
eca9a94
chore: release 2.7.0
release-please[bot] Feb 14, 2020
9bba5f5
docs: relax the tests for face / person detection (#381)
nnegrey Mar 6, 2020
5a9b240
chore: release 2.8.0 (#386)
release-please[bot] Mar 9, 2020
375c74c
docs: move samples out of branch and add tests (#390)
nnegrey Mar 11, 2020
6c9b0cf
chore: release 2.9.0 (#391)
release-please[bot] Mar 11, 2020
8e9519e
chore: release 2.10.0 (#403)
release-please[bot] Mar 18, 2020
60029e7
feat: logo recognition update to GA
telpirion Mar 24, 2020
27e256d
docs: fix failing video tests and remove invalid file (#421)
nnegrey Apr 6, 2020
7fb3ad7
feat!: drop node8, remove eslint, update gax, fix generated protos, r…
alexander-fenster Apr 11, 2020
818fe9b
remove smoke-test hack (#431)
xiaozhenliu-gg5 Apr 20, 2020
e6e29aa
chore: release 3.0.0 (#424)
release-please[bot] Jun 3, 2020
31666ee
chore: changes person and face detection comments (#444)
telpirion Jun 10, 2020
05aeef5
chore(deps): update dependency mocha to v8 (#446)
renovate-bot Jun 11, 2020
cfd5b7f
chore: release 3.0.1 (#448)
release-please[bot] Jun 29, 2020
e486d30
chore: fixes the flaky tests (#486)
munkhuushmgl Oct 22, 2020
e08be75
chore: added retry logic for flaky tests (#487)
munkhuushmgl Oct 26, 2020
e68cabd
chore: release 3.1.0 (#489)
release-please[bot] Nov 2, 2020
a0a0212
samples: refactored speech transcribe sample to meet same standards a…
munkhuushmgl Nov 3, 2020
7d55bef
chore: release 3.1.1 (#494)
release-please[bot] Nov 16, 2020
a94bb4f
chore(deps): update dependency yargs to v16 (#500)
renovate-bot Nov 19, 2020
3ce1867
chore: release 3.1.2 (#502)
release-please[bot] Dec 2, 2020
7a4528f
feat: person detection samples to GA (#504)
telpirion Dec 3, 2020
5f1d5e6
chore: release 3.2.0 (#505)
release-please[bot] Dec 8, 2020
5b432e9
chore: added retry logic for flaky test issue #495
morgandu Dec 15, 2020
9015fb7
chore: increased timeout on flaky service (#514)
munkhuushmgl Jan 6, 2021
b089095
chore: release 3.3.0 (#509)
release-please[bot] Jan 12, 2021
0e90dbb
docs: update typo analyze.js
redvivi Jan 27, 2021
9ee24f2
samples: updates face and person to v1 (#528)
telpirion Apr 5, 2021
ea4a4a6
fix: update region tag from v1beta1 to v1 for analyze-face-detection.…
morgandu Apr 6, 2021
0b0c80c
chore: release 3.3.1 (#531)
release-please[bot] Apr 28, 2021
6cb102a
chore: new owl bot post processor docker image (#546)
gcf-owl-bot[bot] May 10, 2021
8752269
chore: release 3.3.2 (#545)
release-please[bot] May 13, 2021
97a6961
samples: add streaming_automl_object_tracking sample (#547)
morgandu May 24, 2021
e8a9a26
chore: release 3.3.3 (#554)
release-please[bot] Jun 10, 2021
716f003
chore: release 3.3.4 (#567)
release-please[bot] Jun 22, 2021
24b3ab8
chore: release 3.3.5 (#574)
release-please[bot] Jun 30, 2021
3ff7f0b
chore: release 3.3.6 (#578)
release-please[bot] Jul 21, 2021
a0ab434
chore: release 3.4.0 (#616)
release-please[bot] Sep 15, 2021
9e09d5b
chore: release 3.4.1 (#618)
release-please[bot] Sep 15, 2021
4938f94
chore: Cleanup timestamp setting blocks in samples (#631)
nicain Dec 7, 2021
72679b2
build!: update library to use Node 12 (#714)
sofisl May 23, 2022
f3c2a85
chore(main): release 4.0.0 (#715)
release-please[bot] Jun 30, 2022
a72e7d8
test: disable all samples testing (#750)
alexander-fenster Sep 21, 2022
d9fa2d9
chore(main): release 4.1.0 (#748)
release-please[bot] Sep 22, 2022
72952cf
chore(main): release 4.1.1 (#763)
release-please[bot] Nov 8, 2022
a31d39e
Merge remote-tracking branch 'migration/main' into nodejs-video-intel…
Nov 16, 2022
3dc8e7e
Add workflows config
Nov 16, 2022
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
67 changes: 67 additions & 0 deletions .github/workflows/video-intelligence.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: video-intelligence
on:
push:
branches:
- main
paths:
- 'video-intelligence/**'
pull_request:
paths:
- 'video-intelligence/**'
pull_request_target:
types: [labeled]
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: google-github-actions/auth@v1.0.0
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3
with:
node-version: 14
- run: npm install
working-directory: video-intelligence
- run: npm test
working-directory: video-intelligence
env:
MOCHA_REPORTER_SUITENAME: video-intelligence
MOCHA_REPORTER_OUTPUT: video_intelligence_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule' && always() }}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"datastore/functions",
"scheduler",
"talent",
"video-intelligence",
"contact-center-insights",
"workflows"
]
3 changes: 3 additions & 0 deletions video-intelligence/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
rules:
no-console: off
81 changes: 81 additions & 0 deletions video-intelligence/analyze-face-detection-gcs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2020 Google LLC
//
// 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.

'use strict';

function main(gcsUri = 'YOUR_STORAGE_URI') {
// [START video_detect_faces_gcs]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const gcsUri = 'GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4';

// Imports the Google Cloud Video Intelligence library + Node's fs library
const Video = require('@google-cloud/video-intelligence').v1;

// Creates a client
const video = new Video.VideoIntelligenceServiceClient();

async function detectFacesGCS() {
const request = {
inputUri: gcsUri,
features: ['FACE_DETECTION'],
videoContext: {
faceDetectionConfig: {
// Must set includeBoundingBoxes to true to get facial attributes.
includeBoundingBoxes: true,
includeAttributes: true,
},
},
};
// Detects faces in a video
// We get the first result because we only process 1 video
const [operation] = await video.annotateVideo(request);
const results = await operation.promise();
console.log('Waiting for operation to complete...');

// Gets annotations for video
const faceAnnotations =
results[0].annotationResults[0].faceDetectionAnnotations;

for (const {tracks} of faceAnnotations) {
console.log('Face detected:');

for (const {segment, timestampedObjects} of tracks) {
console.log(
`\tStart: ${segment.startTimeOffset.seconds}.` +
`${(segment.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${segment.endTimeOffset.seconds}.` +
`${(segment.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);

// Each segment includes timestamped objects that
// include characteristics of the face detected.
const [firstTimestapedObject] = timestampedObjects;

for (const {name} of firstTimestapedObject.attributes) {
// Attributes include 'glasses', 'headwear', 'smiling'.
console.log(`\tAttribute: ${name}; `);
}
}
}
}

detectFacesGCS();
// [END video_detect_faces_gcs]
}

main(...process.argv.slice(2));
84 changes: 84 additions & 0 deletions video-intelligence/analyze-face-detection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright 2020 Google LLC
//
// 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.

'use strict';

function main(path = 'YOUR_LOCAL_FILE') {
// [START video_detect_faces]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const path = 'Local file to analyze, e.g. ./my-file.mp4';

// Imports the Google Cloud Video Intelligence library + Node's fs library
const Video = require('@google-cloud/video-intelligence').v1;
const fs = require('fs');

// Creates a client
const video = new Video.VideoIntelligenceServiceClient();

// Reads a local video file and converts it to base64
const file = fs.readFileSync(path);
const inputContent = file.toString('base64');

async function detectFaces() {
const request = {
inputContent: inputContent,
features: ['FACE_DETECTION'],
videoContext: {
faceDetectionConfig: {
// Must set includeBoundingBoxes to true to get facial attributes.
includeBoundingBoxes: true,
includeAttributes: true,
},
},
};
// Detects faces in a video
// We get the first result because we only process 1 video
const [operation] = await video.annotateVideo(request);
const results = await operation.promise();
console.log('Waiting for operation to complete...');

// Gets annotations for video
const faceAnnotations =
results[0].annotationResults[0].faceDetectionAnnotations;
for (const {tracks} of faceAnnotations) {
console.log('Face detected:');
for (const {segment, timestampedObjects} of tracks) {
console.log(
`\tStart: ${segment.startTimeOffset.seconds}` +
`.${(segment.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${segment.endTimeOffset.seconds}.` +
`${(segment.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);

// Each segment includes timestamped objects that
// include characteristics of the face detected.
const [firstTimestapedObject] = timestampedObjects;

for (const {name} of firstTimestapedObject.attributes) {
// Attributes include 'glasses', 'headwear', 'smiling'.
console.log(`\tAttribute: ${name}; `);
}
}
}
}

detectFaces();
// [END video_detect_faces]
}

main(...process.argv.slice(2));
89 changes: 89 additions & 0 deletions video-intelligence/analyze-person-detection-gcs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright 2020 Google LLC
//
// 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.

'use strict';

function main(gcsUri = 'YOUR_STORAGE_URI') {
// [START video_detect_person_gcs]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const gcsUri = 'GCS URI of the video to analyze, e.g. gs://my-bucket/my-video.mp4';

// Imports the Google Cloud Video Intelligence library + Node's fs library
const Video = require('@google-cloud/video-intelligence').v1;

// Creates a client
const video = new Video.VideoIntelligenceServiceClient();

async function detectPersonGCS() {
const request = {
inputUri: gcsUri,
features: ['PERSON_DETECTION'],
videoContext: {
personDetectionConfig: {
// Must set includeBoundingBoxes to true to get poses and attributes.
includeBoundingBoxes: true,
includePoseLandmarks: true,
includeAttributes: true,
},
},
};
// Detects faces in a video
// We get the first result because we only process 1 video
const [operation] = await video.annotateVideo(request);
const results = await operation.promise();
console.log('Waiting for operation to complete...');

// Gets annotations for video
const personAnnotations =
results[0].annotationResults[0].personDetectionAnnotations;

for (const {tracks} of personAnnotations) {
console.log('Person detected:');

for (const {segment, timestampedObjects} of tracks) {
console.log(
`\tStart: ${segment.startTimeOffset.seconds}` +
`.${(segment.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${segment.endTimeOffset.seconds}.` +
`${(segment.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);

// Each segment includes timestamped objects that
// include characteristic--e.g. clothes, posture
// of the person detected.
const [firstTimestampedObject] = timestampedObjects;

// Attributes include unique pieces of clothing, poses (i.e., body
// landmarks) of the person detected.
for (const {name, value} of firstTimestampedObject.attributes) {
console.log(`\tAttribute: ${name}; Value: ${value}`);
}

// Landmarks in person detection include body parts.
for (const {name, point} of firstTimestampedObject.landmarks) {
console.log(`\tLandmark: ${name}; Vertex: ${point.x}, ${point.y}`);
}
}
}
}

detectPersonGCS();
// [END video_detect_person_gcs]
}

main(...process.argv.slice(2));
Loading