WOLFRAM

LocalAdaptiveBinarize
LocalAdaptiveBinarize

creates a binary image from image by replacing values above the mean of the range-r neighborhood with 1 and others with 0.

LocalAdaptiveBinarize[image,r,{α,β,γ}]

replaces values above with 1 and others with 0, where and are the local mean and standard deviation.

Details and Options

  • Local adaptive binarization determines the binarization thresholds locally and is typically used for segmenting the foreground of an image with nonuniform illumination or background.
  • LocalAdaptiveBinarize[image,r] is equivalent to LocalAdaptiveBinarize[image,r,{1,0,0}].
  • Using radius r, local mean and standard deviation are computed over blocks centered on each pixel.
  • LocalAdaptiveBinarize assumes the index coordinate system for images.
  • LocalAdaptiveBinarize works with 2D and 3D images, starting the binarization by converting multichannel and color images into grayscale.
  • The following options can be used:
  • Padding "Fixed"what padding scheme to use
    PerformanceGoal $PerformanceGoalwhat aspect of performance to optimize

Examples

open allclose all

Basic Examples  (1)Summary of the most common use cases

Locally adaptive thresholding of a color image in the presence of uneven illumination:

Out[3]=3

Scope  (10)Survey of the scope of standard use cases

Data  (3)

Local thresholding of a grayscale image:

Out[1]=1

A 3D volume:

Out[1]=1

A 3D color volume:

Out[1]=1

Parameters  (7)

Specify a radius parameter of 1 to use 3×3 neighborhoods:

Out[1]=1

Specify a radius parameter of 10 to use 21×21 neighborhoods:

Out[1]=1

Segment pixels brighter than the local average around them:

Out[1]=1

Segment pixels brighter than the fraction 0.9 of the local average:

Out[1]=1

Segment pixels brighter than the local average plus half the standard deviation:

Out[1]=1

Segment pixels brighter than the local average minus 0.05:

Out[1]=1

Specify thresholding coefficients for local average, local standard deviation, and offset:

Out[1]=1

Options  (8)Common values & functionality for each option

PerformanceGoal  (4)

Use PerformanceGoal->"Quality" to emphasize quality of the result:

Out[4]=4

Use PerformanceGoal->"Speed" to emphasize speed of computation:

Out[1]=1

With PerformanceGoal->"Speed", the quality degrades toward the right and bottom:

Out[1]=1

Using PerformanceGoal->"Quality", computation time increases with respect to the radius:

Out[2]=2
Out[3]=3
Out[4]=4

Padding  (4)

By default, "Fixed" padding is used:

Out[1]=1

Use zero padding:

Out[1]=1

Use smaller neighborhoods at the boundaries of the image:

Out[1]=1

Compare different padding settings:

Out[1]=1

Applications  (3)Sample problems that can be solved with this function

Features under uneven illumination are typically not recognized correctly:

TextRecognize fails in this case and returns only a few letters:

Out[2]=2

Improve the result of text recognition by removing uneven illumination:

Out[3]=3

Extract a cloth texture by removing uneven illumination:

Out[1]=1

Segment an electronic board:

Out[1]=1

Properties & Relations  (1)Properties of the function, and connections to other functions

A simple thresholding is performed when the coefficients for average and standard deviation are zero:

Out[5]=5

Interactive Examples  (1)Examples with interactive outputs

Interactively adjust the coefficients:

Out[1]=1
Wolfram Research (2014), LocalAdaptiveBinarize, Wolfram Language function, https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html (updated 2016).
Wolfram Research (2014), LocalAdaptiveBinarize, Wolfram Language function, https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html (updated 2016).

Text

Wolfram Research (2014), LocalAdaptiveBinarize, Wolfram Language function, https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html (updated 2016).

Wolfram Research (2014), LocalAdaptiveBinarize, Wolfram Language function, https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html (updated 2016).

CMS

Wolfram Language. 2014. "LocalAdaptiveBinarize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html.

Wolfram Language. 2014. "LocalAdaptiveBinarize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html.

APA

Wolfram Language. (2014). LocalAdaptiveBinarize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html

Wolfram Language. (2014). LocalAdaptiveBinarize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html

BibTeX

@misc{reference.wolfram_2025_localadaptivebinarize, author="Wolfram Research", title="{LocalAdaptiveBinarize}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html}", note=[Accessed: 08-June-2025 ]}

@misc{reference.wolfram_2025_localadaptivebinarize, author="Wolfram Research", title="{LocalAdaptiveBinarize}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html}", note=[Accessed: 08-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_localadaptivebinarize, organization={Wolfram Research}, title={LocalAdaptiveBinarize}, year={2016}, url={https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html}, note=[Accessed: 08-June-2025 ]}

@online{reference.wolfram_2025_localadaptivebinarize, organization={Wolfram Research}, title={LocalAdaptiveBinarize}, year={2016}, url={https://reference.wolfram.com/language/ref/LocalAdaptiveBinarize.html}, note=[Accessed: 08-June-2025 ]}