Connected Components of an Image or Matrix

IMAGE_COMPONENTS is a FORTRAN90 library which seeks to count and label the connected nonzero/nonblack components in an image or integer vector, matrix or 3D block.


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


IMAGE_COMPONENTS is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

IMAGE_DENOISE, a FORTRAN90 library which applies simple filtering techniques to remove noise from an image.

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

REGION, a FORTRAN90 library which reads 3D MRI voxel data, and groups the voxels into connected regions;


  1. Jonas Gomes, Luiz Velho,
    Image Processing for Computer Graphics,
    Springer, 1997,
    ISBN: 0387948546,
    LC: T385.G65.
  2. William Pratt,
    Digital Image Processing,
    Second Edition,
    Wiley, 1991,
    ISBN13: 978-0471857662,
    LC: TA1632.P7.

Source Code:

Examples and Tests:

List of Routines:

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

Last revised on 27 February 2011.