Image.threshold_adaptive#

Image.threshold_adaptive(C: int = 0, h: int = 3, method: str = 'mean', blocksize: int | None = None) Image[source]#

Adaptive threshold

Parameters:
  • C (int, optional) – _description_, defaults to 0

  • h (int, optional) – half-width of window, defaults to 3

Returns:

thresholded image

Return type:

Image

The threshold at each pixel is the mean over a \(w \times w, w=2h+1\) window minus C. h should reflect the scale of the objects that are to be segmented from the background.

References:

Important

Uses OpenCV function cv2.adaptiveThreshold which accepts single-channel, CV_8U images.

Seealso:

threshold threshold_interactive otsu opencv.adaptiveThreshold