1. A method for image processing, comprising: obtaining a mask of an image; identifying, in the mask, a first stroke segment and a second stroke segment for possible merging, wherein the first stroke segment and the second stroke segment do not overlap; calculating a plurality of merger eligibility scores for the first stroke segment and the second stroke segment; calculating an aggregate merger eligibility score for the first stroke segment and the second stroke segment based on the plurality of merger eligibility scores; and merging the first stroke segment and the second stroke segment based on the aggregate merger eligibility score, wherein calculating the plurality of merger eligibility scores comprises: calculating a length of a gap between the first stroke segment and the second stroke segment; comparing the length of the gap with a length of the second stroke segment, wherein the second stroke segment is shorter than the first stroke segment; and setting a closeness score to the smaller of: an upper bound; and a ratio of the length of the second stroke segment to the length of the gap, wherein the plurality of merger eligibility scores comprises the closeness score.