use of com.amazonaws.services.rekognition.model.CelebrityDetail in project aws-doc-sdk-examples by awsdocs.
the class VideoDetect method GetResultsCelebrities.
// Gets the results of a celebrity detection analysis by calling GetCelebrityRecognition.
// Celebrity detection is started by calling StartCelebrityRecognition.
private static void GetResultsCelebrities() throws Exception {
int maxResults = 10;
String paginationToken = null;
GetCelebrityRecognitionResult celebrityRecognitionResult = null;
do {
if (celebrityRecognitionResult != null) {
paginationToken = celebrityRecognitionResult.getNextToken();
}
celebrityRecognitionResult = rek.getCelebrityRecognition(new GetCelebrityRecognitionRequest().withJobId(startJobId).withNextToken(paginationToken).withSortBy(CelebrityRecognitionSortBy.TIMESTAMP).withMaxResults(maxResults));
System.out.println("File info for page");
VideoMetadata videoMetaData = celebrityRecognitionResult.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());
System.out.println("Job");
System.out.println("Job status: " + celebrityRecognitionResult.getJobStatus());
// Show celebrities
List<CelebrityRecognition> celebs = celebrityRecognitionResult.getCelebrities();
for (CelebrityRecognition celeb : celebs) {
long seconds = celeb.getTimestamp() / 1000;
System.out.print("Sec: " + Long.toString(seconds) + " ");
CelebrityDetail details = celeb.getCelebrity();
System.out.println("Name: " + details.getName());
System.out.println("Id: " + details.getId());
System.out.println();
}
} while (celebrityRecognitionResult != null && celebrityRecognitionResult.getNextToken() != null);
}
Aggregations