A computerized method for extracting from a two-dimensional digital image a one-dimensional digital signal along a projection line, comprising: receiving the two-dimensional digital image, which comprises a plurality of pixels arranged on a pixel grid; receiving information describing the projection line, from which can be obtained an orientation of the projection line, wherein the orientation is one of a set of allowable orientations, the set of allowable orientations being a plurality of orientations that are not parallel to the pixel grid and are not diagonal to the pixel grid, and wherein the orientation of the projection line has a slope that is the ratio of an integer N to an integer D; selecting, responsive to the orientation, a repeating sequence of P pixel weight templates (310, 311, 312, 313, 314, 315, 316) and a sequence of P relative positions, wherein the sequence is repeated by shifting it N pixels in a x-direction and D pixels in a y-direction, with P being equal to the sum of N and D, wherein the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) comprises at least two distinct pixel weight templates (310, 311, 312, 313, 314, 315, 316), wherein the relative positions define the positions of the pixel weight templates within the sequence; and computing a sequence of weighted sums of pixels of the digital image using the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) placed at the sequence of relative positions to extract the one-dimensional signal along the projection line; wherein the repeating sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) and the sequence of relative positions are created by first creating raw pixel weight templates by assigning a weight to each element that is part of a template as a function of position with respect to the geometric center of the template, and then adjusting the weights such as to make the centers of mass of the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316), when placed according to the sequence of relative positions, substantially equally spaced along a straight line; wherein the straight line is substantially parallel to the projection line. receiving the two-dimensional digital image, which comprises a plurality of pixels arranged on a pixel grid; receiving information describing the projection line, from which can be obtained an orientation of the projection line, wherein the orientation is one of a set of allowable orientations, the set of allowable orientations being a plurality of orientations that are not parallel to the pixel grid and are not diagonal to the pixel grid, and wherein the orientation of the projection line has a slope that is the ratio of an integer N to an integer D; selecting, responsive to the orientation, a repeating sequence of P pixel weight templates (310, 311, 312, 313, 314, 315, 316) and a sequence of P relative positions, wherein the sequence is repeated by shifting it N pixels in a x-direction and D pixels in a y-direction, with P being equal to the sum of N and D, wherein the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) comprises at least two distinct pixel weight templates (310, 311, 312, 313, 314, 315, 316), wherein the relative positions define the positions of the pixel weight templates within the sequence; and computing a sequence of weighted sums of pixels of the digital image using the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) placed at the sequence of relative positions to extract the one-dimensional signal along the projection line; wherein the repeating sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316) and the sequence of relative positions are created by first creating raw pixel weight templates by assigning a weight to each element that is part of a template as a function of position with respect to the geometric center of the template, and then adjusting the weights such as to make the centers of mass of the sequence of pixel weight templates (310, 311, 312, 313, 314, 315, 316), when placed according to the sequence of relative positions, substantially equally spaced along a straight line; wherein the straight line is substantially parallel to the projection line.