The embodiment of the invention provides a phase focusing method,
electronic equipment, a storage medium and a program product, and is applied to the technical field of
electronics. According to the method, under the condition that an optical anti-shake module is started, a first
phase image collected by a phase detection pixel and a first coordinate of the position where the optical anti-shake module is located at a target moment are obtained, and a phase
gain compensation matrix is determined according to the first coordinate and a plurality of phase
gain calibration matrixes; the relative positions of the optical center of the lens and the optical center of the
image sensor are different when the plurality of phase
gain calibration matrixes are calibrated, the phase gain compensation matrix is adopted to compensate the first
phase image, and phase focusing is carried out based on a second
phase image obtained after compensation. Therefore, according to the embodiment of the invention, the brightness value of the pixel in the second phase image obtained after compensation can be more uniform, so that the
phase difference information determined based on the second phase image is more accurate, and the focusing stability and the focusing accuracy in an optical anti-shake mode are improved.