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: obtaining a primary depth map associated with one of the left image and the right image and corresponding to a plurality of first pixels, wherein the primary depth map records the primary depth values respectively corresponding to the first pixels; dividing one of the left image and the right image into a plurality of segmentations according to pixel information of the first pixels to obtain a plurality of segmentation maps, comprising: deciding a dividing fineness of each of the depth planes, and dividing the one of the left image and the right image associated with the necessary repair depth map into the segmentations according to the dividing finenesses for obtaining the segmentation maps respectively corresponding to each of the depth planes, wherein the depth planes are respectively corresponding to a plurality of depth-of-field ranges different from one another, and the dividing fineness of each of the depth planes is decided based on the depth-of-field ranges corresponding to each of the depth planes, wherein the step of dividing the one of the left image and the right image associated with the necessary repair depth map into the segmentations according to the dividing finenesses comprises: restricting a segmentation dimension of each of the segmentations according to a dimension threshold to obtain the segmentation maps, wherein the segmentation dimension of each of the segmentations is not greater than the dimension threshold, and the dividing fineness of the segmentation maps is decided according to the dimension threshold; determining whether the primary depth values corresponding to the first pixels match a reliability condition by using the segmentation maps, and removing a plurality of invalid depth values mismatching to the reliability condition among the primary depth values from the primary depth map so as to generate a necessary repair depth map having a plurality of holes; partitioning the necessary repair depth map into a plurality of depth planes according to the primary depth values and a camera parameter; 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.