The diploma thesis presents a system for detecting defects on a specific workpiece with the help of machine vision. For a reliable inspection, we need the appropriate hardware, which depends on the workpiece. Only in this way will the system be accurate, fast and reliable, which is very important in machine vision. Initially, cameras and lenses used in machine vision are described. Proper lighting is also very important for such a system. Examples of lighting and placement of these in relation to the camera are given. The central part presents the steps for selecting the hardware and setting up the system itself. It was necessary to determine the workpiece and the errors to be inspected. Depending on the selected errors, the selection of appropriate tools and the creation of the application followed. The result of the system gives us an estimate of the workpiece and information about the performed measurement. In the conclusion, the properties of the system are summarized and possible improvements are presented.