adapting the threshold for pixels in a CMOS or CCD pixel sensor for black and white recognition