- Updated adaptive thresholding algo
- Added reference and best achievable threshold as output arguments