The state-of-the-art technique to control slug pests in agriculture is the spreading of slug pellets. This method has some downsides, because slug pellets also harm beneficials and often fail because their efficiency depends on the prevailing weather conditions. This study is part of a research project which is developing a pest control robot to monitor the field, detect slugs, and eliminate them. Robots represent a promising alternative to slug pellets. They work independent of weather conditions and can distinguish between pests and beneficials. As a prerequisite, a robot must be able to reliably identify slugs irrespective of the characteristics of the surrounding conditions. In this context, the utilization of computer vision and image analysis methods are challenging, because slugs look very similar to the soil, particularly in color images. Therefore, the goal of this study was to develop an optical filter-based system that distinguishes between slugs and soil. In this context, the spectral characteristics of both slugs and soil in the visible and visible near-infrared (VNIR) wavebands were measured. Conspicuous maxima followed by conspicuous local minima were found for the reflection spectra of slugs in the near infrared range from 850 nm to 990 nm]. Thus, this enabled differentiation between slugs and soils; soils showed a monotonic increase in the intensity of the relative reflection for this wavelength. The extrema determined in the reflection spectra of slugs were used to develop and set up a slug detector device consisting of a monochromatic camera, a filter changer and two narrow bandpass filters with nominal wavelengths of 925 nm and 975 nm. The developed optical system takes two photographs of the target area at night. By subtracting the pixel values of the images, the slugs are highlighted, and the soil is removed in the image due to the properties of the reflection spectra of soils and slugs. In the resulting image, the pixels of slugs were, on average, 12.4 times brighter than pixels of soil. This enabled the detection of slugs by a threshold method.