A method for scanning a document with a device that combines the functionality of a computer mouse and the combined functionality of a scanner, comprising the following steps: determining the relative translational and rotational displacement of the device by using one or more navigation sensors (202, 204; 205); providing a sequence of image frames by using an image area sensor; assigning a positional shift (Δx, Δy, Δθ) of an estimated position (x0, y0, θ0) of each individual image frame captured by the image area sensor regarding at least one of the preceding image frames, wherein said positional shift (Δx, Δy, Δθ) is calculated with information from said navigation sensor (202, 204; 205); adjusting said positional shift (Δx, Δy, Δθ) in a further step with additional image information from said area image sensor; characterized by representing the plurality of successive image frames as a network of nodes and edges, each node representing an image frame of the plurality of successive image frames, and each edge representing a relative pose of neighbouring frames; for at least one of the image frames, computing a first pose for that image frame based on relative poses along a first path through the network to the node representing that image frame, and computing a second pose for that image frame based on relative poses along a second path through the network to the node representing that image frame, wherein the difference between the first and second poses represent an inconsistency in the network; adjusting the position of image frames represented by the nodes along the first path, and/or, adjusting the position of image frames represented by nodes along the second path, to minimise the inconsistency in the network. determining the relative translational and rotational displacement of the device by using one or more navigation sensors (202, 204; 205); providing a sequence of image frames by using an image area sensor; assigning a positional shift (Δx, Δy, Δθ) of an estimated position (x0, y0, θ0) of each individual image frame captured by the image area sensor regarding at least one of the preceding image frames, wherein said positional shift (Δx, Δy, Δθ) is calculated with information from said navigation sensor (202, 204; 205); adjusting said positional shift (Δx, Δy, Δθ) in a further step with additional image information from said area image sensor; representing the plurality of successive image frames as a network of nodes and edges, each node representing an image frame of the plurality of successive image frames, and each edge representing a relative pose of neighbouring frames; for at least one of the image frames, computing a first pose for that image frame based on relative poses along a first path through the network to the node representing that image frame, and computing a second pose for that image frame based on relative poses along a second path through the network to the node representing that image frame, wherein the difference between the first and second poses represent an inconsistency in the network; adjusting the position of image frames represented by the nodes along the first path, and/or, adjusting the position of image frames represented by nodes along the second path, to minimise the inconsistency in the network.