Black/White Version of Grayscale Image

IMAGE_THRESHOLD is a MATLAB function 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.


function bw = image_threshold ( gray, a )


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


IMAGE_THRESHOLD is available in a MATLAB version.

Related Data and Programs:

IMAGE_CONTRAST, a MATLAB program which applies image processing techniques to increase the contrast in an image.

IMAGE_DENOISE, a MATLAB library which applies image processing techniques to remove noise from an image.

IMAGE_DIFFUSE, a MATLAB library which uses diffusion to smooth out an image.

IMAGE_EDGE, a MATLAB program which demonstrates a simple technique for edge detection in an image.

IMAGE_MATCH_GENETIC, a MATLAB program which tries to match a 256x256 JPEG image by blending 32 colored rectangles, using ideas from genetic algorithms, based on an example by Nick Berry.

IMAGE_NOISE, a MATLAB library which adds noise to an image.

IMAGE_QUANTIZATION, a MATLAB library which demonstrates how the KMEANS algorithm can be used to reduce the number of colors or shades of gray in an image.

IMAGE_RGB_TO_GRAY, a MATLAB function which creates a grayscale version of an RGB image.


MathWorks documentation for the Image Processing Toolbox is available at

Source Code:

Examples and Tests:

CONJUNCTION is an astronomical image.

STAR_FIELD is an astronomical image.

You can go up one level to the MATLAB source codes.

Last revised on 27 February 2011.