当前位置: 首页>>代码示例>>Java>>正文


Java DetectLabelsResult类代码示例

本文整理汇总了Java中com.amazonaws.services.rekognition.model.DetectLabelsResult的典型用法代码示例。如果您正苦于以下问题:Java DetectLabelsResult类的具体用法?Java DetectLabelsResult怎么用?Java DetectLabelsResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DetectLabelsResult类属于com.amazonaws.services.rekognition.model包,在下文中一共展示了DetectLabelsResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processTask

import com.amazonaws.services.rekognition.model.DetectLabelsResult; //导入依赖的package包/类
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);
    }
}
 
开发者ID:jhy,项目名称:RekognitionS3Batch,代码行数:22,代码来源:Processor.java

示例2: handleRequest

import com.amazonaws.services.rekognition.model.DetectLabelsResult; //导入依赖的package包/类
@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;
}
 
开发者ID:markwest1972,项目名称:smart-security-camera,代码行数:30,代码来源:RekognitionImageAssessmentHandler.java

示例3: getLabels

import com.amazonaws.services.rekognition.model.DetectLabelsResult; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:16,代码来源:Rekognition.java


注:本文中的com.amazonaws.services.rekognition.model.DetectLabelsResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。