In underwater environments, light waves are attenuated by scattering and absorption, which cause problems such as low contrast, blurred underwater image, and color distortion. The color image sensor has three basic color sensors of RGB and each color sensor can detect light information of different wavelengths. Since different wavelengths of light have different transmission coefficients, the differences within these basic colors need to be considered to solve the above problems. Aiming at the problem that the brightness of R channel is decayed as the red band light is seriously absorbed by water, we propose a new method to obtain the distance between the scene and the camera and the attenuation factor of R channel due to water absorption based on electromagnetic wave theory, and ultimately get the transmission coefficient of R channel. In order to validate the feasibility of proposed method, the quality of experimental images is evaluated both by subjective and objective evaluation. The evaluation results show that compared with the traditional algorithm, the proposed method can compensate the image color and remove blur more effectively and make the restored image more realistic.