TextReader

class TextReader(dir: File, recFile: File, threads: Int, gpu: Boolean = false) : AutoCloseable(source)

recFile is the line reader (OcrModel.recFile; the Search Lab swaps in others).

Constructors

Link copied to clipboard
constructor(dir: File, recFile: File, threads: Int, gpu: Boolean = false)

Types

Link copied to clipboard
class FrameText

One video frame's text: its boxes, a small greyscale thumbnail of each, and each box's line (null where it didn't read as text).

Link copied to clipboard
class Line(val text: String, val corners: FloatArray, val starts: FloatArray, val ends: FloatArray)

A line of text and where it is, for Live Text: corners in the image's pixels (top-left, top-right, bottom-right, bottom-left, in reading direction: x, y pairs), and where each character of text starts and ends along the line, 0 to 1.

Properties

Link copied to clipboard

Time spent per step, in ns, when set (Search Lab's profile); null in normal use. Keys: detect, cut, recognize, decode, batches.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun read(original: Bitmap): List<String>

Lines of text, top to bottom; empty when there are none.

Link copied to clipboard

Reads a video frame, but only the text that changed since previous: a box in about the same place that also looks the same (a caption still on screen) keeps its earlier line. A new subtitle in the same spot looks different, so it's read. Reading lines is most of the cost; finding them is cheap.

Link copied to clipboard

Every line of text with its place, top to bottom.