Skip to content

Commit

Permalink
Remove entire video from faces (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ace Nassri authored and jmdobry committed Jul 7, 2017
1 parent d10e884 commit 8542a5e
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions packages/google-cloud-videointelligence/samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,11 @@ video.annotateVideo(request)
const faces = annotations.faceAnnotations;
faces.forEach((face, faceIdx) => {
console.log('Thumbnail size:', face.thumbnail.length);

const isEntireVideo = face.segments.some((segment) =>
segment.startTimeOffset.toNumber() === -1 &&
segment.endTimeOffset.toNumber() === -1
);

if (isEntireVideo) {
console.log(`Face #${faceIdx}`);
console.log(`\tEntire video`);
} else {
face.segments.forEach((segment, segmentIdx) => {
console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`);
console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`);
console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`);
});
}
face.segments.forEach((segment, segmentIdx) => {
console.log(`Face #${faceIdx}, appearance #${segmentIdx}:`);
console.log(`\tStart: ${segment.startTimeOffset / 1e6}s`);
console.log(`\tEnd: ${segment.endTimeOffset / 1e6}s`);
});
});

// Gets labels for video from its annotations
Expand Down

0 comments on commit 8542a5e

Please sign in to comment.