The invention provides a method for accurately calculating the volume of a cubic object based on a depth image, and the method comprises the steps: obtaining the depth image and a gradient image of the cubic object, carrying out the classification of pixel points in the depth image, and obtaining an edge point image and segmented images of the upper surface, the left vertical plane and the right vertical plane of the cubic object; carrying out edge line detection on the edge point graph, clustering and merging all detected edge lines to obtain a collinear edge line group set, extracting angular points according to the longest edge line of each group, and pairing the angular points; determining the upper surface and the overall contour of the cubic object; obtaining a contour edge line of the upper surface and determining an upper surface quadrangle according to the contour edge line; calculating the length and the width of the cubic object according to the quadrangle on the upper surface, fitting four vertical planes, accurately calculating the length, the width and the height of the cubic object, and calculating the volume of the cubic object. The method is applied to the logistics industry, the problems of volume measurement limitation and time consumption of targets such as cubic object-shaped packages can be solved, and the package sorting efficiency is improved.