The Bayer filter is an overlay microfilter for image sensors that enables photosensors, which typically only record light intensity, to also record light wavelength. The typical image sensors that we use in digital cameras are made up of several tiny photosensors that collectively capture light. These photosensors can natively record light intensity but not light wavelength (color). As a result, "color filter arrays" or "color filter mosaics" are frequently layered on top of image sensors. The recognized pixels are covered by a multitude of microscopic filters, which enable them to render color information. By effectively averaging the color information from the multiple interpolated color filters and the relative brightness detected by the pixels, the digital image processor is able to decode the color of a region. The Bayer filter is one of the most popular filter configurations used in modern gadgets.
Did you know that the human retina has a built-in preference for green light during the day? Bryce Bayer attempted to emulate our visual perception by using this knowledge to set his filter proportions, which favor green light. Another filter that he suggested was made with cyan, magenta, and yellow as the color palette, but it wasn't made until much later because the appropriate dyes weren't available at the time. You can find the CMY variant, which has a greater quantum efficiency, in some more recent digital cameras.
With a Bayer Filter, each pixel receives input from all three primary hues, but because each pixel only records one of the three, they are unable to output all of the wavelength information. Thus, both camera firmware and software can employ a variety of methods to comprehend the full color values of each pixel in order to convert the "Bayer pattern" image to a full-color image in a process called demosaicing.