An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, is configured to perform operations comprising:
- acquiring a multispectral image, and determining a multispectral response value of each pixel in the multispectral image;
- reconstructing an RGB image according to the multispectral image;
- converting the RGB image into a grayscale image;
- and
- determining a target region in the grayscale image, wherein in the target region a grayscale value is less than or equal to a threshold, and calculating a light source spectrum response value according to multispectral response values of pixels of the multispectral image corresponding to the target region.