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.
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 $PerformanceGoal what aspect of performance to optimize

Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Scope (10)Survey of the scope of standard use cases
Data (3)
Parameters (7)
Specify a radius parameter of 1 to use 3×3 neighborhoods:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-mf6imy

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-k054t6

Segment pixels brighter than the local average around them:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-pw6a9m

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-xgkiqv

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-x7wj3o

Segment pixels brighter than the local average minus 0.05:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-xxlpg1

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-w3pso0

Options (8)Common values & functionality for each option
PerformanceGoal (4)
Use PerformanceGoal->"Quality" to emphasize quality of the result:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-u9u10g

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-nsrahi

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-rn9r8g

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

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-zdrjjs

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-r48n8w


https://wolfram.com/xid/0mfgcnjs4a5s1j09om-9ntupj


https://wolfram.com/xid/0mfgcnjs4a5s1j09om-ti806f

Padding (4)
By default, "Fixed" padding is used:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-dzrqtf


https://wolfram.com/xid/0mfgcnjs4a5s1j09om-l2dc94

Use smaller neighborhoods at the boundaries of the image:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-rvs7nf

Compare different padding settings:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-2xfu50

Applications (3)Sample problems that can be solved with this function
Features under uneven illumination are typically not recognized correctly:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-6a7suz
TextRecognize fails in this case and returns only a few letters:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-v8lpic

Improve the result of text recognition by removing uneven illumination:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-xnvp0j

Extract a cloth texture by removing uneven illumination:

https://wolfram.com/xid/0mfgcnjs4a5s1j09om-tb6989


https://wolfram.com/xid/0mfgcnjs4a5s1j09om-ycf5d0

Properties & Relations (1)Properties of the function, and connections to other functions
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
]}
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
]}