This work presents a framework for automatic feature extraction from images using stochastic geometry. Features in images are modeled as realizations of a spatial point process of geometrical shapes. This framework allows the incorporation of a priori knowledge on the spatial repartition of features. More specifically, we present a model based on the superposition of a process of segments and a process of rectangles. The former is dedicated to the detection of linear networks of discontinuities, whereas the latter aims at segmenting homogeneous areas. An energy is defined, favoring connections of segments, alignments of rectangles, and a relevant interaction between both types of objects. The estimation is performed by minimizing the energy using a simulated annealing algorithm. The proposed model is applied to the analysis of digital elevation models (DEMs). These images are raster data representing the altimetry of a dense urban area. We present results on real data provided by the French National Geographic Institute (IGN) consisting in low-quality DEMs of various types.