Complement lines feature detector with a better adaptive thresholded. Clean up the code.