如何设置setLanguageHints

时间:2017-12-07 09:15:03

标签: java android google-cloud-platform google-cloud-vision

// Base64编码 JPEG

base64EncodedImage.encodeContent(imageBytes);
annotateImageRequest.setImage(base64EncodedImage);

                    // add the features we want
                    annotateImageRequest.setFeatures(new ArrayList<Feature>() {{
                        Feature textDetection = new Feature();
                        textDetection.setType("TEXT_DETECTION");
                        add(textDetection);
                    }});
                    ImageContext ImageCon = new ImageContext();
                    ImageCon.cou("th,us");
                    annotateImageRequest.setImageContext(ImageCon);
                    // Add the list of one thing} to the request
                    add(annotateImageRequest);
                }});

1 个答案:

答案 0 :(得分:0)

有关如何向ImageContext添加语言提示的示例应为:

ImageContext imageContext = new ImageContext();
String [] languages = { "zh-TW" };
imageContext.setLanguageHints(Arrays.asList(languages));