Display a Numeric Array as a Grayscale Image

IMSHOW_NUMERIC is a MATLAB program which displays a numeric array as a grayscale image.

MATLAB's Image Processing Toolbox works with images stored as 2D or 3D arrays of a special type, typically "uint8", that is, an unsigned 8 bit integer whose values are between 0 and 255.

Many image processing algorithms require numeric operations on real data, which MATLAB typically types as "double", and return values with fractional parts, in arbitrary ranges that might include negative values.

Thus, if one wants to carry out simple numeric versions of image processing algorithms, one must repeatedly convert numeric data to image data to view it using MATLAB's imshow() command, for instance.

This function, instead, allows a user to display a numeric array by passing it directly as the argument to a function called imshow_numeric(), which makes a quick and simple conversion of the numeric data to a format of the appropriate type and range for display.

The current version of the program only handles grayscale data, that is, a 2D numeric array.


imshow_numeric ( A )


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


IMSHOW_NUMERIC is available in a MATLAB version.

Related Data and Programs:

IMAGE_COMPONENTS, a MATLAB library which seeks the connected "nonzero" or "nonblack" components of an image or integer vector, array or 3D block.

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

IMAGE_DENOISE, MATLAB programs which apply image processing techniques to remove noise from an image.

IMAGE_EDGE, a MATLAB library which demonstrates a simple procedure for edge detection in images.

IMAGE_NOISE, MATLAB programs which add 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, MATLAB programs which makes a grayscale version of an RGB image.

IMAGE_THRESHOLD, MATLAB programs which make a black and white version of a grayscale image by setting all pixels below or above a threshold value to black or white.


MathWorks documentation for the Image Processing Toolbox is available at

Source Code:

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

Last revised on 10 December 2016.