The present invention relates to a method for monitoring the filling of a capsule with a medicament, to a corresponding filling method, to the associated apparatuses, and to a computer program for controlling the method and the apparatus. In the monitoring method, after at least part of the capsule has been filled with a predefined filling mass of a predefined closed contour of the medicament, at least the filling mass in the part of the capsule after the filling operation is recorded using digital imaging in a first step, the contour of the filling mass in the part of the capsule is determined from the digital imaging recording in a second step, and the contour is analysed in a third step in order to assess the filling operation in comparison with the predefined contour. The invention provides for external influences on the image properties to be compensated for by controlling the optical system.