“Bayer raw images” are monochrome images that have not undergone demosaicing. Demosaicing, or color filter array (CFA) interpolation, is the process in which a multi-channel color image is reconstructed from a single-channel monochromatic image that has spatially undersampled color channels due to being output from an image sensor that has a CFA overlaid.
Example Bayer pattern CFA configuration
Close-up of a slanted-edge from a bayer raw image. The image has not undergone demosaicing.
Imatest has the capability to analyze bayer raw images, which can be especially useful in relation to measurement of spatial frequency resolution (SFR). It may be desirable to know the sharpness of an image prior to demosaicing or other post-processing steps that occur during the conversion from raw image data to color image data. Imatest allows the user to measure SFR on the uninterpolated color channels derived from a bayer raw image.
Imatest assumes that a bayer raw image is composed of four color channels (1 red, 1 blue, and 2 green, e.g., RGGB). The user can select an individual color channel from the bayer raw image to use as the primary channel for analysis and display (although all color channels will still be analyzed).
The Monochrome Read window includes options for interpretation of bayer raw images
A subsampled single-channel image is constructed for each color channel by extracting and using only the pixels corresponding to the respective channel. Each subsampled single-channel image is one fourth the size of the original image. The SFR analysis is performed on each of the four subsampled single-channel images. Resulting spatial frequencies are naturally scaled, depending on certain user-selected options such as “MTF plot units” (spatial frequency units) and pixel size.
Four subsampled images, representing the individual color channels of the CFA, are extracted from the full size bayer raw image to use for SFR analysis
For SFR analysis of bayer raw images, Imatest also provides a setting called “Bayer frequency units” which has two options: “Cycles per total pixels” and “Cycles per channel pixels”. The “Cycles per channel pixels” option is only available for spatial frequency units that relate to image size (such as image height and crop height). For all other spatial frequency units, the “Bayer frequency units” setting is disabled and defaults to the “Cycles per total pixel” option.
The More Settings window includes options for “MTF plot units” (spatial frequency units) and “Bayer frequency units”
The “Cycles per total pixels” option scales spatial frequencies according to the full image size, while the “Cycles per channel pixels” option scales spatial frequencies according to the size of the subsampled single-channel image. Consequentially, Nyquist frequency will be halved when using the “cycles per channel pixel” option.
A recent update of Imatest (affects versions 2020.2.14+, 2021.1.9+, 2021.2.5+, and 22.1 included the following changes to SFR analysis for bayer raw images:
Changed the default “bayer frequency unit” setting (corresponds to the “bayerFrequency” INI option) from 1 to 2 such that the default bayer frequency unit is now “cycles per total pixels” instead of “cycles per channel pixels”.
Bayer frequency setting now properly saves to the INI for all relevant modules
Grayed out “bayer frequency unit” dropdown unless “LW/PH”, “LP/PH”, “LW/CH”, or “LP/CH” spatial frequency units are selected (limits the effect of “bayer frequency unit” option to only image-size-related spatial frequency units)
Changed the labeling of spatial frequencies such that only image-size-related spatial frequency units get the special “total” or “channel” labeling scheme (all other spatial frequencies will always use the standard labeling)
Corrected the spatial frequency scaling for certain combinations of bayer frequency units and spatial frequency units selections (bayer raw SFR results have been corrected for multiple cases)
Previous versions of Imatest would provide incorrect SFR results for bayer raw images when the “Cycles per channel pixels” option was selected. Specifically, resulting spatial frequencies were doubled, with Nyquist mislabeled, implying twice the resolution in the subsampled single-channel image. There was also an issue where results from “cycles per channel pixel” and “cycles per total pixel” were reversed for certain spatial frequency unit options. This update fixed the issue by correcting the scaling of associated SFR results and limiting the “Bayer frequency units” option to spatial frequency units that relate to image size. All other spatial frequency units provide SFR results with natural scaling and are comparable to results from a demosaiced image.