Added auto threshod based on histogram
Signed-off-by: Zhou Chang <achang.zhou@gmail.com>