Aiming at the difficulty of detecting the modulation transfer function (MTF) of Bayer color cameras during focusing, the traditional scheme is modified in this paper. First, through analysis, it is found that the MTF of the Bayer detector decreased substantially compared to the monochromatic detector, which was caused by the loss of a large amount of light from the Bayer detector. When the MTF is calculated for the color image after de-mosaicing, the degradation of image quality leads to the inability to obtain the full-frequency MTF curve. Therefore, this paper proposes a solution to detect the MTFs of the three primary colors in the Bayer image individually, and then weight the MTFs of each primary color to obtain the MTF of the color image based on the calibration results of the light source. Then, considering the steps of differentiation and Fourier transform in the slanted-edge method, this paper solves the problem of non-uniform sampling of edge spread function by using the modification of the slanted-edge method with non-uniform Fourier transform. Finally, the optimal imaging position of a certain type of Bayer color camera is determined using the methods proposed in this paper. Simulation and test results verify the effectiveness and accuracy of the methods in this paper.