Line

public class Line extends Object
implements Text

A line of text.

Public Method Summary

float
getAngle ()
Angle of rotation (in degrees, clockwise being positive) of its bounding box about the top-left corner.
Rect
getBoundingBox ()
Axis-aligned bounding box containing the text.
List<? extends Text>
getComponents ()
Smaller components that comprise this entity, if any.
Point[]
getCornerPoints ()
Four corner points in clockwise direction starting with top-left.
String
getLanguage ()
Prevailing language in the text, if any.
String
getValue ()
Retrieve the recognized text as a string.
boolean
isVertical ()
Whether or not the text layout is vertical.

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface com.google.android.gms.vision.text.Text
abstract Rect
getBoundingBox ()
Axis-aligned bounding box containing the text.
abstract List<? extends Text>
getComponents ()
Smaller components that comprise this entity, if any.
abstract Point[]
getCornerPoints ()
Four corner points in clockwise direction starting with top-left.
abstract String
getLanguage ()
Prevailing language in the text, if any.
abstract String
getValue ()
Retrieve the recognized text as a string.

Public Methods

public float getAngle ()

Angle of rotation (in degrees, clockwise being positive) of its bounding box about the top-left corner.

public Rect getBoundingBox ()

Axis-aligned bounding box containing the text. The bounding box may extend past the image boundary.

public List<? extends Text> getComponents ()

Smaller components that comprise this entity, if any. If this entity is an atom, an empty list is returned. TextBlock is at the top of the Text hierarchy. TextBlock contains Line objects, which contains Element s. Element s are atoms. We may decide to add character-level objects in later versions.

For example, a client could draw bounding boxes for recognized text in different colors for paragraphs, lines, words, and alphabets by repeatedly traversing down the tree with this method.

public Point[] getCornerPoints ()

Four corner points in clockwise direction starting with top-left. Due to the possible perspective distortions, this is not necessarily a rectangle. Parts of the region could be outside of the image.

public String getLanguage ()

Prevailing language in the text, if any. The format is in BCP47 (e.g. "en" or "sr-Latn-BA") or "und" if the language could not be determined.

public String getValue ()

Retrieve the recognized text as a string. Returned in reading order for the language. For Latin, this is top to bottom within a TextBlock, and left-to-right within Lines.

public boolean isVertical ()

Whether or not the text layout is vertical.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2021年06月17日 UTC.