Algorithm behind exposure bias in HDR imaging texture

Working around with openCV i was able to get better result :
See my StackOverflow thread for more information and code sample.