本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
}