A method and apparatus for three-dimensional detection of objects, and the use of the device and of the method