| CPC G06T 11/203 (2013.01) [G06T 7/90 (2017.01); G06V 10/56 (2022.01); G06V 10/751 (2022.01); G06T 2207/10024 (2013.01)] | 20 Claims |

|
1. A method for generating a signed distance field image, comprising:
determining a target closed curve in an unsigned distance field image of target text, and determining an origin corresponding to the target closed curve;
drawing a target triangle by taking two adjacent sample points on the target closed curve and the origin as vertices according to a sampling order of the adjacent sample points, wherein the sampling order is a preset direction along the target closed curve;
performing counting for pixels within the target triangle based on a drawing direction of the target triangle, wherein
the drawing direction of the target triangle is a clockwise direction or a counterclockwise direction;
a counting manner in a case where the drawing direction is the clockwise direction is inverse to a counting manner in a case where the drawing direction is the counterclockwise direction; and
the counting manners comprise increment by N per count or decrement by N per count, and N is a nonzero number;
determining that pixels having counting results equal to 0 in the unsigned distance field image are located in an interior region of the target text, and determining that pixels having counting results not equal to 0 in the unsigned distance field image are located in the exterior region of the target text; and
generating a signed distance field image of the target text based on the pixels located in the exterior region of the target text, the pixels located in the interior region of the target text, and the unsigned distance field image.
|