This paper presents an efficient technique for linking edge points in order to generate a closed-contour representation. It is based on the consecutive use of global and local schemes. In both cases it is assumed that the original intensity image, as well as its corresponding edge map, are given as inputs to the algorithm. The global scheme computes an initial representation by connecting edge points minimizing a global measure based on spatial information (3D space). It relies on the use of graph theory and exploits the edge points' distribution through the given edge map, as well as their corresponding intensity values. At the same time spurious edge points are removed by a morphological filter. The local scheme finally generates closed contours, linking open boundaries, by using a local cost function that takes into account both spatial and topological information. Experimental results with different images, together with comparisons with a previous technique, are presented.