Measurement of surface roughness is an important metrology procedure widely used in the industry during the final phases of the manufacturing process for quality control. This paper presents a measurement system that uses an optical microscope equipped with a vision sensor to measure the surface roughness of bearings. Shape from Focus / Defocus method is applied to measure the 3D surface coordinates of the object surface from which roughness calculations can be undertaken.