OxfordComputerVisionClient visionClient = new OxfordComputerVisionClient(new BasicOxfordCredentilas(
"**********"));
InputStream stream = getClass().getResourceAsStream("test.png");
OCRRequest request = new OCRRequest();
request.withDetectOrientation(true).withLanguage(Language.JAPANESE).withInputStream(stream);
OCRResponse response = visionClient.recognizeText(request);
if (response.getStatus() == 200) {
Language language = response.getLanguage();
int textAngle = response.getTextAngle();
String orientation = response.getOrientation();
List<Region> regions = response.getRegions();
for (Region region : regions) {
BoundingBox boundingBox = region.getBoundingBox();
boundingBox.getMinX();
boundingBox.getMinX();
boundingBox.getWidth();
boundingBox.getHeight();
List<Line> lines = region.getLines();
for (Line line : lines) {
line.getBoundingBox();
List<Word> words = line.getWords();
for (Word word : words) {
BoundingBox b = word.getBoundingBox();
String text = word.getText();
}
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 1
tottok-ug/ProjectOxfordJavaClient
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published