當前位置: 首頁>>代碼示例>>Java>>正文


Java DetectLabelsRequest類代碼示例

本文整理匯總了Java中com.amazonaws.services.rekognition.model.DetectLabelsRequest的典型用法代碼示例。如果您正苦於以下問題:Java DetectLabelsRequest類的具體用法?Java DetectLabelsRequest怎麽用?Java DetectLabelsRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DetectLabelsRequest類屬於com.amazonaws.services.rekognition.model包,在下文中一共展示了DetectLabelsRequest類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processTask

import com.amazonaws.services.rekognition.model.DetectLabelsRequest; //導入依賴的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.DetectLabelsRequest; //導入依賴的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.DetectLabelsRequest; //導入依賴的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.DetectLabelsRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。