image_edge, a C code which demonstrates the detection of edges in an image.

NEWS is a particularly simple edge detection scheme, which compares the North, East, West, and South neighbors of a pixel to determine if the pixel lies along an edge.

There are many sophisticated edge detection algorithms, and MATLAB has many of them built into its image processing toolbox. The purpose of these examples is simply to demonstrate how a simple version of such edge detection schemes works.


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


image_edge is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

EDGE, a C code which defines some test functions in 1D, 2D and 3D for the detection of edges or discontinuities. It uses GNUPLOT to display the jumps in curves and surfaces.

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


PBMA_IO, a C code which handles the ASCII Portable Bit Map (PBM) format.

PGMA_IO, a C code which handles the ASCII Portable Gray Map (PGM) format.


  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.
  3. Barry Wilkinson, Michael Allen,
    Parallel Programming: Techniques and Applications using Networked Workstations and Parallel Computers,
    Pearson/Prentice Hall, 2005,
    ISBN: 0-13-140563-2,
    LC: QA76.642.W54.

Source Code:

Last modified on 08 July 2019.