1. An electronic device comprising a positioning unit for positioning an object which has a plurality of sides and obtaining a coordinate of each point of the object; an infrared measuring unit, wherein when the electronic device is positioned on one point of the object, the infrared measuring unit calculates a distance between the object and the electronic device; a capturing unit; a processor; and a storage device coupled to the processor and configured to store instructions for execution by the processor to cause the processor to: acquire coordinates of at least four points which are not assigned on a same side of the object from the positioning unit when the infrared measuring unit determines that the distance between the object and the electronic device is equal to zero or is less than a preset value; create a cuboid model including the at least four points as vertices based on the coordinates of the at least four points; control the capturing unit to capture a photo including a reference object and a space, measure a height and a width of the reference object and the space on the photo, and acquire a height and a width of the reference object to calculate a height H of the space by a formula: H=H0*H2/H1, and a width of the space by a formula: W=W0*W2/W1, wherein the width of the reference object is W0, the height of the reference object is H0, the width of the reference object on the photo is W1, the height of the reference object on the photo is H1, the width of the space on the photo is W2, and the height of the space on the photo is H2; determine whether it is feasible for the object to pass through the space based on a length, a width, and a height of the cuboid model and the height and the width of the space; and output a result.