Dynamic range optimization by Local contrast correction and histogram image analysis