imshow_numeric, a MATLAB code 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 MIT license


imshow_numeric is available in a MATLAB version.

Related Data and Programs:

image_components, a MATLAB code which seeks the connected "nonzero" or "nonblack" components of an image or integer vector, array or 3d block.

image_contrast, a MATLAB code which applies image processing techniques to increase the contrast in an image.

image_denoise, MATLAB codes which apply image processing techniques to remove noise from an image.

image_edge, a MATLAB code which demonstrates a simple procedure for edge detection in images.

image_noise, MATLAB codes which add noise to an image.

image_quantization, a MATLAB code 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 codes which makes a grayscale version of an rgb image.

image_threshold, MATLAB codes 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:

Last revised on 04 February 2019.