Automatic resetting device using electronic means intended for a geometric model of a scene over a picture of the scene, the model and the picture of the scene being stored in the memory of an electronic device in the form of pixel matrices, the scene including fixed references with respect to the remainder of the scene, wherein the references can be detected within the matrices, the picture being taken by a camera arranged in a given zone with respect to the ground in a location of the zone and according to a shot angle determined relative to the scene, wherein the electronic means compares the picture with the model having been adjusted in perspective by homography for superimposition of the references, and wherein the electronic device comprises means enabling to calculate a fine homography function Hf for resetting into three main phases:
- a first preliminary phase of determination of an average resetting homography including determining an average homography function Hm applicable to the model with average adjustment over a sample of pictures of the scene taken previously,
- a second, rough resetting phase including, after application of the average homography function Hm to the model, determining a rough homography function Hg, said second rough resetting phase comprising the steps of:
- applying an extraction process to the picture enabling, according to detection criteria, to detect in the picture matrix of the pixels which can represent references of the scene and to form a first picture reference binary matrix Mrh, including horizontal contour points and a second picture reference binary matrix, Mrv, including vertical contour points,
- calculating for each horizontal reference binary matrix, Mrh, a horizontal reference distance matrix Mdh, including for each element of the matrix the distance value with respect to the closest reference according to the vertical line,
- calculating for each vertical reference binar matrix, Mrv, a vertical reference distance matrix, Mdv, including for each element of the matrix the distance value with respect to the closest reference according to the horizontal line,
- applying all the reference lines of the model to the average homographic function Hm in order to produce a binary average adjusted matrix Mam which is compared with the vertical Mdv, and respective horizontal Mdh reference distance matrices, for pixel matching purposes, and calculating a homography function Hopt by regression with minimization of the medial of the square of the distance between pairs of matched pixels,
- identifying the pairs of pixels corresponding to non-aberrant matches,
- adjusting the homography function, Hopt, by least a square regression calculation over all the non-aberrant pixel pairs in order to produce the rough homography Hg,
- a third, fine resetting phase including, after application of the rough homography function Hg to the model, determining a fine homography function Hf.