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


Java AnalysisResult类代码示例

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


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

示例1: process

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
private String process() throws VisionServiceException, IOException {
    Log.e(LOG_TAG,"processing....");
    Gson gson = new Gson();

    // Put the image into an input stream for detection.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(output.toByteArray());

    AnalysisResult v = this.client.describe(inputStream, 1);

    String result = gson.toJson(v);
    Log.e(LOG_TAG, result);

    return result;
}
 
开发者ID:interritus1996,项目名称:memento-app,代码行数:17,代码来源:bingVisionService.java

示例2: process

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
private String process() throws VisionServiceException, IOException {
    Gson gson = new Gson();
    String[] features = {"ImageType", "Color", "Faces", "Adult", "Categories"};
    String[] details = {};

    // Put the image into an input stream for detection.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(output.toByteArray());

    AnalysisResult v = this.client.analyzeImage(inputStream, features, details);

    String result = gson.toJson(v);
    Log.d("result", result);

    return result;
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:18,代码来源:AnalyzeActivity.java

示例3: analyzeImage

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
public AnalysisResult analyzeImage(String url, String[] visualFeatures, String[] details) throws VisionServiceException {
    Map<String, Object> params = new HashMap<>();
    AppendParams(params, "visualFeatures", visualFeatures);
    AppendParams(params, "details", details);

    String path = apiRoot + "/analyze";
    String uri = WebServiceRequest.getUrl(path, params);

    params.clear();
    params.put("url", url);

    String json = (String) this.restCall.request(uri, "POST", params, null, false);
    AnalysisResult visualFeature = this.gson.fromJson(json, AnalysisResult.class);

    return visualFeature;
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:18,代码来源:VisionServiceRestClient.java

示例4: describe

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
public AnalysisResult describe(InputStream stream, int maxCandidates) throws VisionServiceException, IOException{
    Map<String, Object> params = new HashMap<>();
    params.put("maxCandidates", maxCandidates);
    String path = apiRoot + "/describe";
    String uri = WebServiceRequest.getUrl(path, params);

    params.clear();
    byte[] data = IOUtils.toByteArray(stream);
    params.put("data", data);

    String json = (String) this.restCall.request(uri, "POST", params, "application/octet-stream", false);
    AnalysisResult visualFeature = this.gson.fromJson(json, AnalysisResult.class);

    return visualFeature;
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:17,代码来源:VisionServiceRestClient.java

示例5: process

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
private String process(int type) throws VisionServiceException, IOException {
    Gson gson = new Gson();
    AnalysisResult v = new AnalysisResult();
    client = new VisionServiceRestClient(Constants.keys[current]);
    // Put the image into an input stream for detection.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(output.toByteArray());

    if (type == Constants.ANALYSE)
        v = client.analyzeImage(inputStream, Constants.features, null);
    else if (type == Constants.DESCRIBE)
        v = client.describe(inputStream, 1);

    return gson.toJson(v);
}
 
开发者ID:deeepaaa,项目名称:Captionr,代码行数:17,代码来源:DescribeActivity.java

示例6: onPostExecute

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
protected void onPostExecute(String data) {
    super.onPostExecute(data);
    // Display based on error existence

    if (e != null) {
        Log.e(LOG_TAG,"Error in post execute: " + e.getMessage());
        this.e = null;
    } else {
        Gson gson = new Gson();
        AnalysisResult result = gson.fromJson(data, AnalysisResult.class);

        for (Caption caption: result.description.captions) {
            Log.e(LOG_TAG,"Caption: " + caption.text + ", confidence: " + caption.confidence);
            vision_result = vision_result + " " + caption.text + " (" + caption.confidence + ").";
        }

        LogViewer.addLog("Vision API: "+vision_result);

        /*
        for (String tag: result.description.tags) {
            mEditText.append("Tag: " + tag + "\n");
        }*/
        //doneSignal.countDown();
        detect(mBitmap);
    }
}
 
开发者ID:interritus1996,项目名称:memento-app,代码行数:28,代码来源:bingVisionService.java

示例7: process

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
private String process() throws VisionServiceException, IOException {
    Gson gson = new Gson();

    // Put the image into an input stream for detection.
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, output);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(output.toByteArray());

    AnalysisResult v = this.client.describe(inputStream, 1);

    String result = gson.toJson(v);
    Log.d("result", result);

    return result;
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:16,代码来源:DescribeActivity.java

示例8: onPostExecute

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
protected void onPostExecute(String data) {
    super.onPostExecute(data);
    // Display based on error existence

    mEditText.setText("");
    if (e != null) {
        mEditText.setText("Error: " + e.getMessage());
        this.e = null;
    } else {
        Gson gson = new Gson();
        AnalysisResult result = gson.fromJson(data, AnalysisResult.class);

        mEditText.append("Image format: " + result.metadata.format + "\n");
        mEditText.append("Image width: " + result.metadata.width + ", height:" + result.metadata.height + "\n");
        mEditText.append("\n");

        for (Caption caption: result.description.captions) {
            mEditText.append("Caption: " + caption.text + ", confidence: " + caption.confidence + "\n");
        }
        mEditText.append("\n");

        for (String tag: result.description.tags) {
            mEditText.append("Tag: " + tag + "\n");
        }
        mEditText.append("\n");

        mEditText.append("\n--- Raw Data ---\n\n");
        mEditText.append(data);
        mEditText.setSelection(0);
    }

    mButtonSelectImage.setEnabled(true);
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:35,代码来源:DescribeActivity.java

示例9: onPostExecute

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
protected void onPostExecute(String data) {
    super.onPostExecute(data);
    // Display based on error existence

    mEditText.setText("");
    if (e != null) {
        mEditText.setText("Error: " + e.getMessage());
        this.e = null;
    } else {
        Gson gson = new Gson();
        AnalysisResult result = gson.fromJson(data, AnalysisResult.class);

        mEditText.append("Image format: " + result.metadata.format + "\n");
        mEditText.append("Image width: " + result.metadata.width + ", height:" + result.metadata.height + "\n");
        mEditText.append("Clip Art Type: " + result.imageType.clipArtType + "\n");
        mEditText.append("Line Drawing Type: " + result.imageType.lineDrawingType + "\n");
        mEditText.append("Is Adult Content:" + result.adult.isAdultContent + "\n");
        mEditText.append("Adult score:" + result.adult.adultScore + "\n");
        mEditText.append("Is Racy Content:" + result.adult.isRacyContent + "\n");
        mEditText.append("Racy score:" + result.adult.racyScore + "\n\n") ;

        for (Category category: result.categories) {
            mEditText.append("Category: " + category.name + ", score: " + category.score + "\n");
        }

        mEditText.append("\n");
        int faceCount = 0;
        for (Face face: result.faces) {
            faceCount++;
            mEditText.append("face " + faceCount + ", gender:" + face.gender + "(score: " + face.genderScore + "), age: " + + face.age + "\n");
            mEditText.append("    left: " + face.faceRectangle.left +  ",  top: " + face.faceRectangle.top + ", width: " + face.faceRectangle.width + "  height: " + face.faceRectangle.height + "\n" );
        }
        if (faceCount == 0) {
            mEditText.append("No face is detected");
        }
        mEditText.append("\n");

        mEditText.append("\nDominant Color Foreground :" + result.color.dominantColorForeground + "\n");
        mEditText.append("Dominant Color Background :" + result.color.dominantColorBackground + "\n");

        mEditText.append("\n--- Raw Data ---\n\n");
        mEditText.append(data);
        mEditText.setSelection(0);
    }

    mButtonSelectImage.setEnabled(true);
}
 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:49,代码来源:AnalyzeActivity.java

示例10: onPostExecute

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
@Override
protected void onPostExecute(String data) {
    super.onPostExecute(data);
    // Display based on error existence

    if (e != null) {
        if (current_work == Constants.DESCRIBE)
            mTextView.setText(R.string.just_a_moment_ellipsis);
        this.e = null;
        current -= 2;
        if (current < 0)
            current = Constants.keys.length - 1;
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
                new doRequest(current_work).execute();
            }
        }).start();
    } else {
        Gson gson = new Gson();
        AnalysisResult result = gson.fromJson(data, AnalysisResult.class);

        if (current_work == Constants.DESCRIBE) {

            mTextView.setText("");
            for (Caption caption : result.description.captions)
                mTextView.append(getBeginningFromConfidence(caption.confidence, caption.text) + " " + caption.text);

            bloatShareIn(false);

            new doRequest(Constants.ANALYSE).execute();
        } else if (current_work == Constants.ANALYSE) {

            for (Face face : result.faces)
                mTextView.append(
                        "\n" + getString(R.string.the) + " " +
                                face.gender.toString().toLowerCase() + " " +
                                getString(R.string.here) + " " +
                                getString(R.string.looks) + " " +
                                face.age
                );

            mTextView.append("\n" + getString(R.string.dom_col_is) + " " + result.color.dominantColorForeground.toLowerCase());

            if (result.adult.isAdultContent)
                mTextView.append("\n" + getBeginningFromConfidence(result.adult.adultScore, "") + " not appropriate!");
            bloatShareIn(true);
        }
    }
}
 
开发者ID:deeepaaa,项目名称:Captionr,代码行数:56,代码来源:DescribeActivity.java

示例11: analyzeImage

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
public AnalysisResult analyzeImage(String url, String[] visualFeatures, String[] details) throws VisionServiceException; 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:2,代码来源:VisionServiceClient.java

示例12: describe

import com.microsoft.projectoxford.vision.contract.AnalysisResult; //导入依赖的package包/类
public AnalysisResult describe(String url, int maxCandidates) throws VisionServiceException; 
开发者ID:Microsoft,项目名称:Cognitive-Vision-Android,代码行数:2,代码来源:VisionServiceClient.java


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