A method for mapping a sensor pixel array to an illumination pixel array according to a surface of which a surface contour image is to be generated, comprising: forming a group mapping by assigning each pixel in a plurality of pixels on the sensor array to a corresponding group of a sequential ordered set of k groups of pixels on the illumination pixel array, wherein each group of pixels has p adjacent pixels on the illumination pixel array, and wherein k and p are integers greater than or equal to 3, by: projecting on the surface, and then recording, in a sequence, each one of a sequence of two or more binary group index images, wherein, with respect to each sequentially ordered set of k groups of pixels, each projected group index images has, in at least two of the groups of pixels, no illuminated pixels and has in fewer than k-1 groups of pixels, a number of adjacent illuminated pixels, wherein said number of adjacent illuminated pixels is the same in each of the fewer than k-1 groups, and ranges from 2 to p-1, wherein said adjacent illuminated pixels are located at the same position with the group of pixels, and wherein, when the whole sequence of two or more binary group index images is projected, illuminated pixels from each of the k groups in the sequentially ordered set are used; projecting on the surface, and then recording at least p multiline images, wherein each row of a multiline image is formed by illuminating a single pixel from each group, wherein said single pixel is located in the same position within the group to form a line within each group; correlating lines in the recorded multiline images with lines in the projected multiline images according to the group mapping; and generating a surface contour image of the surface using the correlation. forming a group mapping by assigning each pixel in a plurality of pixels on the sensor array to a corresponding group of a sequential ordered set of k groups of pixels on the illumination pixel array, wherein each group of pixels has p adjacent pixels on the illumination pixel array, and wherein k and p are integers greater than or equal to 3, by: projecting on the surface, and then recording, in a sequence, each one of a sequence of two or more binary group index images, wherein, with respect to each sequentially ordered set of k groups of pixels, each projected group index images has, in at least two of the groups of pixels, no illuminated pixels and has in fewer than k-1 groups of pixels, a number of adjacent illuminated pixels, wherein said number of adjacent illuminated pixels is the same in each of the fewer than k-1 groups, and ranges from 2 to p-1, wherein said adjacent illuminated pixels are located at the same position with the group of pixels, and wherein, when the whole sequence of two or more binary group index images is projected, illuminated pixels from each of the k groups in the sequentially ordered set are used; projecting on the surface, and then recording at least p multiline images, wherein each row of a multiline image is formed by illuminating a single pixel from each group, wherein said single pixel is located in the same position within the group to form a line within each group; correlating lines in the recorded multiline images with lines in the projected multiline images according to the group mapping; and generating a surface contour image of the surface using the correlation. projecting on the surface, and then recording, in a sequence, each one of a sequence of two or more binary group index images, wherein, with respect to each sequentially ordered set of k groups of pixels, each projected group index images has, in at least two of the groups of pixels, no illuminated pixels and has in fewer than k-1 groups of pixels, a number of adjacent illuminated pixels, wherein said number of adjacent illuminated pixels is the same in each of the fewer than k-1 groups, and ranges from 2 to p-1, wherein said adjacent illuminated pixels are located at the same position with the group of pixels, and wherein, when the whole sequence of two or more binary group index images is projected, illuminated pixels from each of the k groups in the sequentially ordered set are used; projecting on the surface, and then recording at least p multiline images, wherein each row of a multiline image is formed by illuminating a single pixel from each group, wherein said single pixel is located in the same position within the group to form a line within each group; correlating lines in the recorded multiline images with lines in the projected multiline images according to the group mapping; and generating a surface contour image of the surface using the correlation.