pixThresholdToBinary | R Documentation |
These functions set a subset of the values in a Pix-class
object to a single specific value.
We can set all pixels with a value greater than threshold to a given
value, or all pixels with a valye less than the threshold to a given value.
If newValue
is greater than or equal to threshold
, then pixels
with a current value above threshold
will be set to
newValue
and all other pixels will remain unchanged.
Alternatively, if newValue
is less than or equal to threshold
,
all pixels with a current value less than threshold
will
be set to newValue
and the pixels with a value
greater than or equal to threshold
will remain unchanged.
For pixThresholdToBinary
, pixels with a value less than
threshold
will be set to 1 (corresponding to white)
and pixels with a value greater than or equal to threshold
will be set to 0 (corresponding to black).
pixThresholdToBinary(pix, threshold) pixThresholdToValue(pix, threshold, newValue, target = NULL)
pix |
a |
threshold |
the threshold value which identifies which pixels to change |
newValue |
the new value for the pixels to take |
target |
either a |
These functions return a new Pix-class
object.
Duncan Temple Lang
pixRead
GetInputImage
pixAnd
f = system.file("images", "SMITHBURN_1952_p3.png", package = "Rtesseract") p1 = pixRead(f) p1 = pixConvertTo8(p1) bin = pixThresholdToBinary(p1, 150) angle = pixFindSkew(bin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.