The APW dithering method is a simple variation of Veryovka-Buchanan dithering method. Here we describe into two parts this 'new method'.
using Iterative Selection
The idea is to provide an estimate of the average gray level of both the background (Tb) and the objects (To), and to use the average of these two levels as threshold: T = (To+Tb)/2. Initially these values are guesses based on know properties of the image. If is know that objects are dark and the background is lighter, the initial values could be Tb= 0 e To=255. Sometimes values from the four corners are assumed to be background pixels. It is even possible to use the overall mean gray levels as the initial threshold T and the produce a guess for Tb and To on the next iteration.
The next step is to refine the values de Tb and To using o threshold T. Assuming that dark regions are objects, To is recalculated to be mean value of all pixels less than T. Similarity, the new value of Tb is the mean value of all pixels with a value greater than T. This produce a better estimate of the mean levels, and these in turn should produce a better estimate threshold which is now recomputed, as before, as T = (To+Tb)/2, using the new values for To and Tb.
This entire process is repeated until the same threshold value T is produced on two consecutive iterations, at which point T is presumed to be a good threshold for the image.
After of find the threshold to segment the image, using the follow algorithm:
If Pixel of Image < Threshold then
Use texture one
The texture one or two is used to be applied to the image. After the segmentation the method of the Veryovka-Buchanan is usually applied.