image_threshold
image_threshold,
an Octave code which
creates a black and white version of a grayscale image
by specifying a single threshold value; pixels below this
value become black, and above this value they are white.
Usage:
function bw = image_threshold ( gray, a )
where
-
gray is an m by n uint8
(short integers, 0 to 255) array containing the grayscale image data;
MATLAB's imread() command can be used to create such a
dataset from a graphics image file.
-
a is a value between 0 and 255 which is used for thresholding.
-
bw is an m by n uint8
array containing the gray scale version of the thresholded
image. All values in this array are 0 or 255.
Licensing:
The information on this web page is distributed under the MIT license.
Languages:
image_threshold is available in
a MATLAB version and
an Octave version.
Related Data and Programs:
image_threshold_test
Reference:
-
Jonas Gomes, Luiz Velho,
Image Processing for Computer Graphics,
Springer, 1997,
ISBN: 0387948546,
LC: T385.G65.
-
William Pratt,
Digital Image Processing,
Second Edition,
Wiley, 1991,
ISBN13: 978-0471857662,
LC: TA1632.P7.
Source Code:
-
image_threshold.m,
sets pixels less than or equal to A to black, and pixels greater
than A to white.
-
image_threshold2.m,
sets pixels less than A to black, and pixels greater than B to white,
leaving intermediate pixels unchanged.
-
image_threshold3.m,
sets pixels less than A or greater than B to white,
leaving intermediate pixels unchanged.
Last revised on 03 August 2024.