Image.threshold_interactive#
- Image.threshold_interactive(title: str | None = None, mode: str = 'binary', block: bool = False) Any[source]#
Interactive thresholding
- Parameters:
title (str, optional) – title for the window, defaults to
Nonemode (str, optional) – threshold display mode, one of
'binary'or'tozero', defaults to'binary'block (bool, optional) – block execution while the interactive window is open, defaults to
False
- Raises:
ValueError – called for a color image
ValueError – unknown mode
- Returns:
selected threshold value
- Return type:
scalar
The image is displayed in a simple Matplotlib GUI along with the histogram and a slider for threshold value. Adjusting the slider changes the thresholded image view.
If
mode='binary'the displayed image is:\[\begin{split}Y_{u,v} = \left\{ \begin{array}{l} 1 \mbox{, if } X_{u,v} > t \\ 0 \mbox{, otherwise} \end{array} \right.\end{split}\]If
mode='tozero'the displayed image is:\[\begin{split}Y_{u,v} = \left\{ \begin{array}{l} X_{u,v} \mbox{, if } X_{u,v} > t \\ 0 \mbox{, otherwise} \end{array} \right.\end{split}\]- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 12.1.1.1.
- Seealso: