GetConfidenceColors | R Documentation |
This is a convenience function for computing the
color values to indicate the confidence/certainty of each of the
recognized elements in the OCR.
This computes the color palette, by default, and then maps
the confidence values into bins.
By default, the more green the value, the more certainty.
A caller can specify different end points of the color range
(via colorEnds
).
GetConfidenceColors(bbox, confidences = bbox[, "confidence"],
numColors = 10,
colors = colorRampPalette(colorEnds)(numColors),
colorEnds = getOption("OCRConfidenceColors", c("red", "lightgreen")),
intervals = quantile(confidences, seq(0, 1, by = 1/numColors)))
bbox |
the matrix of matched elements returned from |
confidences |
the vector of confidence values. These are
extracted from |
numColors |
the number of colors to use in the color palette |
colors |
a vector of color values (as a character vector) in case the caller wants to specify the colors directly. |
colorEnds |
a character vector of two colors giving the
color for the minimum and maximum confidence. These are used to interpolate the
other color values for the confidences. The caller can specify these
two color values via the R session option named |
intervals |
the bins by which to group the confidences |
A character vector of colors corresponding to the rows in bbox
or elements in confidences
Duncan Temple Lang
GetConfidences
, GetBoxes
,
plot
f = system.file("trainingSample", "eng.tables.exp0.png", package = "Rtesseract")
ts = tesseract(f)
bbox = GetBoxes(ts)
colors = GetConfidenceColors(bbox)
plot(ts, bbox = bbox, border = colors)
m = plot(ts, img = NULL, bbox = bbox, border = colors)
rect(m[,1], m[,2], m[,3], m[,4], col = colors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.