We propose a new method aiming at solving the volume measurement problem of the complex-shaped cavity of a workpiece. We first use machine vision technology to obtain the external geometric parameters, and then calculate the external volume of the workpiece through integral principle. Next, we calculate the solid-part volume of the workpiece by dividing its weight by its specific gravity. Finally, by subtracting the solid-part volume from the external volume of the workpiece, we obtain the volume of the inner cavity. The experimental results show that the precision of our method is higher than 0.5%, and the time consumed is less than 20 seconds.