當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。