OpenCV uses some kind of relative threshold here, have a look at the implementation...