1. An apparatus for automatically closing and opening at least one door in a frame, the apparatus comprising: a controller controlling the door, said controller providing a safety mode for retaining the door in an open state, a door reopening mode, or both the safety mode and the door reopening mode in an event of an obstacle blocking a complete closure of the door into the frame; at least one camera having a line of sight intersecting at least a plane of the frame and providing an image of a space divided by the plane of the frame; at least one image analysis unit that isolates regions of interest of an obstacle in the space and being connected to said camera; and a calculator for extracting at least one geometric characteristic of each region of interest, for classifying the geometric characteristic into at least one category of different safety scenarios of known characteristics, and for outputting to said controller a safety signal for activating the safety mode and the safety signal being dependent on an evaluation of a safety alarm value calculated by a formula, in accordance with the category, using at least one weighting of dimensional criteria applied to the geometric characteristics, said calculator connected to said image analysis unit and to said controller, said calculator programmed to distinguish between a stroller, a wheel chair, a dog leash and a bag strap traversing the frame of the door.