use of com.amazonaws.services.rekognition.model.GetPersonTrackingResult in project aws-doc-sdk-examples by awsdocs.
the class VideoDetect method GetResultsPersons.
// Gets person tracking information using the GetPersonTracking operation. Person tracking
// is started by calling StartPersonTracking
private static void GetResultsPersons() throws Exception {
int maxResults = 10;
String paginationToken = null;
GetPersonTrackingResult personTrackingResult = null;
do {
if (personTrackingResult != null) {
paginationToken = personTrackingResult.getNextToken();
}
personTrackingResult = rek.getPersonTracking(new GetPersonTrackingRequest().withJobId(startJobId).withNextToken(paginationToken).withSortBy(PersonTrackingSortBy.TIMESTAMP).withMaxResults(maxResults));
VideoMetadata videoMetaData = personTrackingResult.getVideoMetadata();
System.out.println("Format: " + videoMetaData.getFormat());
System.out.println("Codec: " + videoMetaData.getCodec());
System.out.println("Duration: " + videoMetaData.getDurationMillis());
System.out.println("FrameRate: " + videoMetaData.getFrameRate());
// Show persons, confidence and detection times
List<PersonDetection> detectedPersons = personTrackingResult.getPersons();
for (PersonDetection detectedPerson : detectedPersons) {
long seconds = detectedPerson.getTimestamp() / 1000;
System.out.print("Sec: " + Long.toString(seconds) + " ");
System.out.println("Person Identifier: " + detectedPerson.getPerson().getIndex());
System.out.println();
}
} while (personTrackingResult != null && personTrackingResult.getNextToken() != null);
}
Aggregations