1. A method for transforming a 2D image into a 3D image, comprising steps of: (a) selecting at least one object of the 2D image by an electronic apparatus; (b) setting a base line in the 2D image by the electronic apparatus; (c) calculating a center coordinate of each object and base on the base line, judging whether each object is located on a foreground or a background of the 2D image by the electronic apparatus, wherein N first objects are located on the foreground and M second objects are located on the background, N and M are integers greater than or equal to zero but are not equal to zero at the same time; (d) sorting each of the N first objects and each of the M second objects respectively by the electronic apparatus; (e) according to the sort of the N first objects, offering a first displacement to each of the N first objects by the electronic apparatus, and according to the sort of the M second objects, offering a second displacement to each of the M second objects by the electronic apparatus; (f) moving each of the N first objects with the first displacement and moving each of the M second objects with the second displacement to generate T continuous images by the electronic apparatus, T being a natural number; and (g) sequentially outputting each of the T continuous images to generate the 3D image by the electronic apparatus.