1. A method for detecting, in a digital projection image achieved by using penetrating radiation, the image of a fiducial, positioned in a target to be imaged, wherein the method comprises at least the following steps, where for at least part of the digital projection image pixels, there is calculated the direction of the intensity gradient, and on the basis of the calculated directions of the intensity gradients, there is defined a region in the projection image, where the direction of the intensity gradient changes according to predetermined limits, and there is defined a matching rate for how well the model describing the predetermined image of the fiducial matches the defined area.