The overhead crane is one of dangerous machines. It may cause personnel injury, or even property damages if any accidents happen in working area. Thus, to ensure safe operation, the load size, route and working environment should be taken into consideration. This study developed a safety alarm device for overhead crane to prevent impacting persons or objects, and used image processing technology to create a video surveillance system. It can track the target object automatically and maintain the preset distance between the warning limit and the hanging object as the hanging object ascends or descends. It can be applied on an overhead crane for early warning on collision and prevention of the hanging object from impacting the workers or other equipments. The distance between the obstacle and hanging object is estimated by using perspective projection, translation of axes and rotation skills, thus ensuring the safety effect.