A device for detecting the spectrum of electromagnetic radiation within a specified wavelength range, comprising - a substrate, - a first aperture mask arranged above the substrate and made of a material being non-transmissive to radiation within the specified wavelength range, the first aperture mask comprising a plurality of first windows, - a plurality of sensor elements arranged in the substrate and being sensitive to radiation within the specified wavelength range, and - a second aperture mask arranged above the first aperture mask and comprising second windows, said second aperture mask being made of a material being non-transmissive to the radiation within the specified wavelength range, - wherein the second windows of the second aperture mask are arranged to overlap with the windows of the first aperture mask, and wherein opposite edges of the respective two overlapping windows (22,36) of the two aperture masks (20,32) define the size of a radiation passage assigned to a respective sensor element and designed for allowing radiation of a wavelength within the specified wavelength range to pass to the sensor element arranged below the radiation passage, and - wherein, for detecting the intensity of electromagnetic radiation at each wavelength of interest within the specified wavelength range, at least one of the radiation passages is provided, having a size assigned to one of the respective wavelengths of interest, and - wherein the windows of the first aperture mask have a first distance and the windows of the second aperture mask have a second distance, characterized in that, in the substrate, from the top side thereof, an area is formed which is provided with first charge carriers of a first conductive type, wherein partial areas are formed in said area which are in alignment with the first windows of the first aperture mask and are exposed within the windows, said partial areas being provided with second charge carriers of a second conductive type opposite to the first conductive type and, together with the respective adjacent regions of said area including the first charge carriers, forming a photodiode. - a substrate, - a first aperture mask arranged above the substrate and made of a material being non-transmissive to radiation within the specified wavelength range, the first aperture mask comprising a plurality of first windows, - a plurality of sensor elements arranged in the substrate and being sensitive to radiation within the specified wavelength range, and - a second aperture mask arranged above the first aperture mask and comprising second windows, said second aperture mask being made of a material being non-transmissive to the radiation within the specified wavelength range, - wherein the second windows of the second aperture mask are arranged to overlap with the windows of the first aperture mask, and wherein opposite edges of the respective two overlapping windows (22,36) of the two aperture masks (20,32) define the size of a radiation passage assigned to a respective sensor element and designed for allowing radiation of a wavelength within the specified wavelength range to pass to the sensor element arranged below the radiation passage, and - wherein, for detecting the intensity of electromagnetic radiation at each wavelength of interest within the specified wavelength range, at least one of the radiation passages is provided, having a size assigned to one of the respective wavelengths of interest, and - wherein the windows of the first aperture mask have a first distance and the windows of the second aperture mask have a second distance, characterized in that, in the substrate, from the top side thereof, an area is formed which is provided with first charge carriers of a first conductive type, wherein partial areas are formed in said area which are in alignment with the first windows of the first aperture mask and are exposed within the windows, said partial areas being provided with second charge carriers of a second conductive type opposite to the first conductive type and, together with the respective adjacent regions of said area including the first charge carriers, forming a photodiode.