Overview
Threshold maps all pixels darker than a specified threshold to
pure black and all other pixels to pure white.
Core is similar; it maps all pixels darker than a specified
threshold to pure black, but it leaves all other pixels untouched.
Syntax
Threshold(clip c, int "threshold", int "low", int "high") Core(clip c int threshold, int "low", bool "debug")
Threshold Parameters
"threshold" |
All pixels darker than the threshold value will be mapped to
the low value. All other pixels will be mapped to
the high value. Range: [0, 255] (Default: 128) |
"low" |
(Default: 16 for YUV clips; 0 for RGB clips) Range: [0, 255] |
"high" |
Range: [0, 255] (Default: 235 for YUV clips; 255 for RGB clips) |
Core Parameters
threshold |
All pixels darker than the threshold value will be mapped to
the low value. All other pixels will be left untouched. Range: [0, 255] |
"low" |
Range: [0, 255] (Default: 16 for YUV clips; 0 for RGB clips) |
"debug" |
Pass true to map all pixels affected by Core
to bright green instead of to the low value.Range: [0, 255] (Default: false) |
Usage
Threshold and Core currently support only YUY2,
RGB24, and RGB32 colorspaces.
Behavior can be different in YUV and RGB colorspaces. That is, if you call
Threshold or Core on a YUY2 clip, there can be significant differences if
you call ConvertToRGB() first.
In YUV mode, threshold is not scaled to the [16, 235] CCIR-601 range. If you need it scaled, then you unfortunately will need to compute the scaled threshold yourself.
I don't know anything about MMX/SSE optimizations, so these functions are not as fast as they probably ought to be.
Revision History
-
0.1.2
- Minor fix to handle the case where threshold < low.
-
0.1.1
- Added stricter argument checks.
-
0.1.0
- Initial release.