1. A method performed by a computer having a memory and a processor for determining a location of a captured array of bits within an original array, the original array encoding location information on a surface, wherein the captured array corresponds to an image of the surface captured by a camera of a pen, the determined location indicating the position of the pen relative to the surface, the method comprising: (A) obtaining extracted bits that are associated with the captured image, the extracted bits including encoded position information; (B) determining position coordinates of the center of the captured image by decoding a portion of the extracted bits directly if there are no error bits; and (C) if there are error bits, determining the position coordinates of the center of the captured image, determining first candidates for the position coordinates of the center of the captured image by decoding a first portion of the extracted bits, determining whether the first candidates are consistent with a local constraint, the local constraint identifying a portion of the original array containing eligible position coordinates, when the first candidates are consistent with the local constraint, selecting the first candidates as the position coordinates of the center of the image, and when the first candidates are not consistent with the local constraint, selecting additional portions of the extracted bits, decoding the selected additional portions of the extracted bits to determine candidates for the position coordinates of the center of the image, and when candidates for the position coordinates of the center of the image are determined that are consistent with the local constraint, selecting the candidates for the position coordinates of the center of the image that are consistent with the local constraint as the position coordinates of the center of the image wherein the determining, selecting, and decoding are performed by the processor executing instructions stored in the memory.