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


Java Caption类代码示例

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


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

示例1: onPostExecute

import com.microsoft.projectoxford.vision.contract.Caption; //导入依赖的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

示例2: onPostExecute

import com.microsoft.projectoxford.vision.contract.Caption; //导入依赖的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

示例3: onPostExecute

import com.microsoft.projectoxford.vision.contract.Caption; //导入依赖的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


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