On Chip Error Compensation, Light Adaptation, and Image Enhancement with a CMOS Transform Image Sensor