1. A method for determining positions of a plurality of images in a document on a physical medium, a pattern being displayed on the physical medium, the plurality images being sampled by a camera mounted to a pen or stylus while the pen or stylus is moved across the document such that the plurality of images track the movement of the pen or stylus while creating a stroke in the document, the method comprising: locating at least two images in the plurality of images by detecting a portion of the pattern that is captured in each of the at least two images, and analyzing the detected portions of the pattern in order to determine the positions in the document of the at least two images; segmenting the stroke into segments based on the located images; grouping the plurality of images, each group corresponding to one of the segments of the stroke such that each group comprises: two of the located images corresponding to start and end positions, respectively, of the corresponding segment, and at least one image in the plurality of images corresponding to at least one intermediate position of the corresponding segment; for each group, determining if the corresponding segment of the stroke is unfinished by determining whether the at least one intermediate position corresponds to at least one image whose position in the document has not previously been determined; and for each unfinished segment, using the determined position corresponding to at least one of the start and end positions to determine the position in the document of the at least one image whose position in the document has not previously been determined, wherein the document includes text obscuring a portion of the pattern before the pen or stylus is moved across the document, the obscured portion of the pattern being captured within the at least one image whose position in the document has not previously been determined of an unfinished segment.