lazyslide_models.tile_prediction.cv_features.Sharpness

lazyslide_models.tile_prediction.cv_features.Sharpness#

class Sharpness#

Bases: _CVFeatures

sharpness Variance of the Laplacian; higher means a sharper tile

Calculate the sharpness of a tile.

Sharpness is calculated as the variance of the Laplacian of the pixel values. The Laplacian operator is used to measure the second derivative of an image, which highlights regions of rapid intensity change and is therefore often used for edge detection. High variance in the Laplacian indicates a sharper image.

The tile can be in shape (H, W, C) for a single image or (B, C, H, W) for a batch of images.

columns = ('sharpness',)#

Subclasses whose _func returns a dict set this explicitly; for the rest it is derived below from the class name, which is the same rule _process_batch uses to key its result.