Smart CMOS Image Sensor for 3D Measurement