We proposed a method using a merit function to determine the depth of objects in computational integral imaging by analyzing the existing methods for depth extraction of target objects. To improve the resolution of reconstructed slice images, we use a digital camera moving in horizontal and vertical direction with the set interval to get elemental images with high resolution and bilinear interpolation algorithm to increase the number of pixels in slice image which improves the resolution obviously. To show the feasibility of the proposed method, we carried out our experiment and presented the results. We also compared it with other merit functions. The results show that merit function SMD2 to determine the depth of objects is more accurate and suitable for real-time application.