This paper proposes a method for the automatic extraction of building roof contours from a LiDAR-derived digital surface model (DSM). The method is based on two steps. First, to detect aboveground objects (buildings, trees, etc.), the DSM is segmented through a recursive splitting technique followed by a region merging process. Vectorization and polygonization are used to obtain polyline representations of the detected aboveground objects. Second, building roof contours are identified from among the aboveground objects by optimizing a Markov-random-field-based energy function that embodies roof contour attributes and spatial constraints. Preliminary results have shown that the proposed methodology works properly.