Minor fix
Improve the allocation method for creating histgram
Reduce sample pixels for creating histgram