add implementation of adaptive threshold and basic global threshold