Computer-implemented method for recognizing an object marked by means of a stroke input of a user on the basis of pixels in a digital image comprising the following method steps: - obtaining a digital image, in the memory of a computer; - representing the digital image on a display of the computer; - receiving stroke inputs of a user via an input interface of the computer; - determining the pixels in the digital image which correspond to the stroke input of the user and which are determined as being associated with the object to be recognized, - determining the pixels which lie in a selectable perimeter region around the pixels which correspond to the stroke input of the user, - performing the object recognition using the pixels which correspond to the stroke input of the user and the pixels in the perimeter region, for which purpose for each pixel within the perimeter region it is determined whether, with regard to a selected metric, it lies closer to the outer edge of the perimeter region or closer to the pixels which correspond to the stroke input of the user, wherein for determining whether a pixel from the perimeter region, with regard to a selected metric, lies closer to the outer edge of the perimeter region or closer to the pixels which correspond to the stroke input of the user, use is made of an algorithm for determining the shortest paths with regard to the selected metric in an edge-weighted graph, wherein the pixels in the perimeter region including the pixels at the outer edge of the perimeter region and the pixels which correspond to the stroke input of the user form the nodes of the graph and the weights of the edges of the graph that connect the nodes - corresponding to respectively adjacent pixels - represent a distance between the corresponding pixels with regard to the selected metric, and wherein both the distance with regard to the selected metric between in each case two arbitrary pixels which correspond to the stroke input of the user and the distance between in each case two arbitrary pixels at the outer edge of the perimeter region with regard to the selected metric are set to zero, wherein a pixel within the perimeter region is determined as being associated with the object to be recognized, if, with regard to the selected metric, it lies closer to the pixels which correspond to the stroke input of the user or else a pixel within the perimeter region is not determined as being associated with the object to be recognized if, with regard to the selected metric, it lies closer to the outer edge of the perimeter region, and all pixels of the object marked by means of a stroke input of the user are thus recognized. - obtaining a digital image, in the memory of a computer; - representing the digital image on a display of the computer; - receiving stroke inputs of a user via an input interface of the computer; - determining the pixels in the digital image which correspond to the stroke input of the user and which are determined as being associated with the object to be recognized, - determining the pixels which lie in a selectable perimeter region around the pixels which correspond to the stroke input of the user, - performing the object recognition using the pixels which correspond to the stroke input of the user and the pixels in the perimeter region, for which purpose