Java 类com.amazonaws.services.rekognition.model.DetectLabelsResult 实例源码

项目:RekognitionS3Batch    文件:Processor.java   
private void processTask(Message message) {
    String path = message.getBody();
    PathSplit pathComp = new PathSplit(path);
    String bucket = pathComp.bucket;
    String key = pathComp.key;
    Logger.Info("Processing %s %s", bucket, key);

    // Rekognition: Detect Labels from S3 object
    DetectLabelsRequest req = new DetectLabelsRequest()
        .withImage(new Image().withS3Object(new S3Object().withBucket(bucket).withName(key)))
        .withMinConfidence(minConfidence);
    DetectLabelsResult result;
    result = rek.detectLabels(req);
    List<Label> labels = result.getLabels();
    Logger.Debug("In %s, found: %s", key, labels);

    // Process downstream actions:
    for (LabelProcessor processor : processors) {
        processor.process(labels, path);
    }
}
项目:smart-security-camera    文件:RekognitionImageAssessmentHandler.java   
@Override
public Parameters handleRequest(Parameters parameters, Context context) {

    context.getLogger().log("Input Function [" + context.getFunctionName() + 
            "], Parameters [" + parameters + "]");

    // Create Rekognition client using the parameters available form the runtime context
    AmazonRekognition rekognitionClient = 
            AmazonRekognitionClientBuilder.defaultClient();

    // Create a Rekognition request
    DetectLabelsRequest request = new DetectLabelsRequest().withImage(new Image()
            .withS3Object(new S3Object().withName(parameters.getS3key())
                    .withBucket(parameters.getS3Bucket())));

    // Call the Rekognition Service
    DetectLabelsResult result = rekognitionClient.detectLabels(request);

    // Transfer labels and confidence scores over to Parameter POJO
    for (Label label : result.getLabels()) {
        parameters.getRekognitionLabels().put(label.getName(), label.getConfidence());
    }

    context.getLogger().log("Output Function [" + context.getFunctionName() +
            "], Parameters [" + parameters + "]");

    // Return the result (will be serialised to JSON)
    return parameters;
}
项目:myrobotlab    文件:Rekognition.java   
/**
 * Hopefully, Label is serializable, otherwise it needs to return a list of
 * POJOs.
 * 
 * @return
 */
public List<Label> getLabels(ByteBuffer imageBytes) {
  AmazonRekognition client = getClient();
  DetectLabelsRequest request = new DetectLabelsRequest().withImage(new Image().withBytes(imageBytes)).withMaxLabels(maxLabels).withMinConfidence(minConfidence);
  DetectLabelsResult result = client.detectLabels(request);
  List<Label> labels = result.getLabels();
  lastImage = imageBytes;
  lastLabels = labels;
  return labels;
}