The present application discloses a method and apparatus for generating a panoramic image. A cuboid three-dimensional image of each local space is determined according to an original two-dimensional image of each local space in the overall space and a preset cuboid model corresponding to each local space, and then a three-dimensional panoramic image of the overall space is generated according to all determined cuboid three-dimensional images. Since the three-dimensional panoramic image of the overall space is generated according to the cuboid three-dimensional images of all local spaces, the overall space may be visually viewed at a three-dimensional angle of view to achieve the three-dimensional real-scene effect.