The scanning tunnelling microscope (STM) can be used to study surfaces of crystals at elevated temperatures. In this paper it is shown how the roughening transition on a metal surface can be observed in STM images. From such observations an accurate value of the transition temperature is obtained. In addition, two technical steps are described that are necessary for the analysis of short-range correlation functions in the images in terms of the kink formation energy and the step-step interaction energy. The first step concerns an algorithm for the pattern recognition of kinks and step edges, which is used to acquire automatically the statistical kink distributions from a large number of STM images. The second step deals with the theory of short-range correlation functions and is employed to derive the two energy parameters of interest from the experimental statistical distributions.