A method for generating a pattern vector, in which the following steps are carried out:
- a) defining a contour of an object in a pattern image, wherein the object is detected on a banknote;
- b) defining a gradient direction for pixels of the contour;
- c) defining a gradient amount for pixels of the contour,
- d) defining pixels of the contour as characteristic pixels if the respective gradient amount is greater than an amount threshold value;
- e) defining a respective position of the characteristic pixels;
- f) defining a first direction and a second direction in dependence on the gradient direction of the characteristic pixels;
- and
- g) generating the pattern vector using the respective position of the characteristic pixels in the pattern image and the first direction and the second direction.