A method comprising: providing an instrument having a registration camera and a surface measuring system (V), the surface measuring system (V) having a first camera and a projector , the first camera including an autofocus camera having an autofocus mechanism; for the instrument in a first pose, capturing with the registration camera a first registration image of a first plurality of registration points; for the instrument (10 in the first pose, projecting first light onto an object with the projector , capturing with the first camera a first surface image of the first light on the object , and determining a first plurality of three-dimensional coordinates of surface points on the object based at least in part on the projected first light and the captured first surface image, the first light being a coded or an uncoded pattern of projected light; for the instrument in a second pose, capturing with the registration camera a second registration image of a second plurality of registration points; for the instrument in the second pose, adjusting the autofocus mechanism, projecting second light onto the object with the projector , capturing with the first camera a second surface image of the second light on the object , and determining a compensation parameter based at least in part on the first registration image, the second registration image, the first plurality of 3D coordinates, the projected second light, and the captured second surface image, the second light being a coded or an uncoded pattern of projected light, wherein the compensation parameter is a focal length of the first camera , and wherein the focal length is adjusted until the first plurality of 3D coordinates measured by the surface measuring system (V) at a first time matches the surface of the object measured by the surface measuring system (V) at a second time as well as possible; and storing the determined compensation parameter. providing an instrument having a registration camera and a surface measuring system (V), the surface measuring system (V) having a first camera and a projector , the first camera including an autofocus camera having an autofocus mechanism; for the instrument in a first pose, capturing with the registration camera a first registration image of a first plurality of registration points; for the instrument (10 in the first pose, projecting first light onto an object with the projector , capturing with the first camera a first surface image of the first light on the object , and determining a first plurality of three-dimensional coordinates of surface points on the object based at least in part on the projected first light and the captured first surface image, the first light being a coded or an uncoded pattern of projected light; for the instrument in a second pose, capturing with the registration camera a second registration image of a second plurality of registration points; for the instrument in the second pose, adjusting the autofocus mechanism, projecting second light onto the object with the projector , capturing with the first camera a second surface image of the second light on the object , and determining a compensation parameter based at least in part on the first registration image, the second registration image, the first plurality of 3D coordinates, the projected second light, and the captured second surface image, the second light being a coded or an uncoded pattern of projected light, wherein the compensation parameter is a focal length of the first camera , and wherein the focal length is adjusted until the first plurality of 3D coordinates measured by the surface measuring system (V) at a first time matches the surface of the object measured by the surface measuring system (V) at a second time as well as possible; and storing the determined compensation parameter. <EOS>