Automated visual inspection is widely used to guarantee the desired quality of a product. However, the signal of a single grayscale or RGB camera might not be sufficient for demanding inspection tasks. By the inclusion of spectral regions outside the visible wavelength range a classification can be improved. Thereby, the near infrared region is of particular significance, which has been used in spectroscopy for quality control and analytics for many years. Hyperspectral image aquisition provides a high resolution spectrum for each pixel, but its use for visual inspection is limited due to high costs, complex signal processing, and low speed. By reducing the measurement to those spectral regions that allow a good classification, a simpler and faster inspection system can be designed. An approach for the selection of optical filters using hyperspectral images is presented and evaluated based on using an example of the field of bulk materials sorting.