我知道这可能是一个愚蠢的问题,但我很难将视觉识别从识别文本转换为我可以使用和操作的字符串。
这是在 Java 中。
有人可以帮忙吗?它可能与挖掘方法并找到正确的组合有关......
package com.mycompany.app;
import com.ibm.watson.developer_cloud.visual_recognition.v3.VisualRecognition;
import com.ibm.watson.developer_cloud.visual_recognition.v3.model.*;
import java.io.File;
import java.util.concurrent.ExecutionException;
public class App
{
public static void main( String[] args ) throws ExecutionException, InterruptedException {
VisualRecognition service = new VisualRecognition(VisualRecognition.VERSION_DATE_2016_05_20);
service.setApiKey("a46d79a8aa20ed4b1ad3bc25a449c15d212d5db7");
ClassifierOptions p = new ClassifierOptions.Builder().classifierName("letters").addClass("H", new File("src/pictures/CapitalH.zip")).addClass("h", new File("src/pictures/LowercaseH.zip")).build();
File f1 = new File("src/pictures/CapitalH.zip");
File f2 = new File("src/pictures/LowercaseH.zip");
File f3 = new File("src/pictures/HiM.zip");
//VisualClassifier c1 = service.createClassifier("H", f1, f2);
//service.createClassifier(p).execute();
//VisualClassifier c1 = new VisualClassifier();
//VisualClass cc1 = (VisualClass) service.createClassifier(p);
service.createClassifier(p);
VisualRecognitionOptions ops; //find out how to add classifications for letters to this, then add this to visualClassification
ClassifyImagesOptions pp = new ClassifyImagesOptions.Builder().images(f3).classifierIds("H").build();
ClassifyImagesOptions ppp = new ClassifyImagesOptions.Builder().images(f3).build();
VisualClassification result = service.classify(pp).execute();
VisualRecognitionOptions now = new VisualRecognitionOptions.Builder().images(f3).build();
//System.out.println(service.recognizeText(now).execute());
//System.out.println(service.recognizeText(now));
RecognizedText t = service.recognizeText(now).execute();
t = service.recognizeText(now).rx().join();
String s = service.recognizeText(now).rx().toString();
//System.out.println(service.getClassifiers());
//System.out.println(result);
}
}