ImageProcessing.flatten_image_and_get_noise_level

giant.image_processing:

ImageProcessing.flatten_image_and_get_noise_level(image)[source]

This method is used to sample the noise level of an image, as well as return a flattened version of the image.

There are 2 techniques for flattening the image.

In the first, GLOBAL technique: the image is flattened by subtracting off a median filtered copy of the image from the image itself

The standard deviation of the noise level in the image is then estimated by either calculating the standard deviation of flattened user defined dark pixels for the image (contained in the OpNavImage.dark_pixels attribute) or by calculating the standard deviation of 2,000 randomly sampled differences between pixel pairs of the flattened image spaced 5 rows and 5 columns apart.

In the second, LOCAL technique: the image is split into regions based on flattening_kernel_size. For each region, a linear background gradient is estimated and subtracted from the region. The global flattened image is then flattened further by subtracting off a median filtered copy of the flattened image.

The standard deviation of the noise level is then computed for each region by sampling about half of the points in the flattened region and computing the standard deviation of the flattened intensity values. In this case 3 values are returned, the flattened image, the list of noise values for each region, and a list of slices defining the regions that were processed.

This method is used by locate_subpixel_poi_in_roi() in order to make the point of interest identification easier.

Parameters:

image (ndarray) – The image to be flattened and have the noise level estimated for

Returns:

The flattened image and the noise level as a tuple, or the flattened image, the noise levels as a list, and a list of slices of tuples specifying the regions of the image the noise levels apply to.

Return type:

Tuple[ndarray, float] | Tuple[ndarray, List[float], List[Tuple[slice, slice]]]