# Hard Dynamic Threshold

Whether you specify a hard threshold directly or you compute a threshold using relative thresholding, the intent is to come up with a threshold that effectively segments background pixels from object pixels, as shown in the following figure:

.

Hard dynamic thresholding is a process that automatically computes an appropriate threshold value based on the input image histogram. Hard dynamic thresholding computes this threshold by computing the threshold value that minimizes the weighted variance among the pixels on each side of the threshold. This tends to produce a good threshold for images with bimodal distributions of pixel values. The following figure shows how an effective threshold value is associated with low variance of the pixel values on either side of the threshold:

Hard dynamic thresholding may not work well on input images that do not contain a bimodal distribution of pixel values.