1. A method for optimizing depth information, for an electronic device, wherein a left image and a right image are generated through shooting of a three dimensional imaging system, and the method comprises: dividing one of the left image and the right image into a plurality of segmentations to obtain a plurality of segmentation maps; obtaining a necessary repair depth map, and partitioning the necessary repair depth map into a plurality of depth planes according to a plurality of primary depth values and a camera parameter, wherein the necessary repair depth map records the primary depth values and has a plurality of holes; and respectively generating a plurality of optimized depth values for the holes in each of the depth planes by using the segmentation maps, and filling the optimized depth values into the depth planes to obtain an optimized depth map combining each of the depth planes.