Illumination invariant measurement of mechanical dimensions using a multiple segmentation method