Abstract: A method for measuring the height of an object, including projecting a light pattern having successive coded picture elements extending in a direction of a transversal axis onto the object by a light source. Each of the picture elements has at least one coding feature and the picture elements together define a code word. The picture element groups from a sequence of a predetermined number of successive picture elements each define individual partial code words, existing exactly once within the code word. Capturing the light pattern by a picture sensor arranged off-set to the light source. Determining the positions of the picture element groups and determining the height of the object the determined position of the picture element groups in comparison to a respective reference position.