lazyslide.models.tile_prediction.Sharpness

Contents

lazyslide.models.tile_prediction.Sharpness#

class Sharpness#

Bases: _CVFeatures

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.