0

Suppose I have an image like this:

image-1

But I want to make as close as possible to this image(which is more realistic):

image-2

The stroke of the image should not be changed. I just want to change the background, add some noise, and most importantly, change the width in various portions of the stroke to make it look like a real pen stroke. Thanks in advance.

Rahat Zaman
  • 1,322
  • 14
  • 32
  • Can you show your code? – Alderven Feb 25 '19 at 02:09
  • Add Color background - simple. After try to generate noise: https://stackoverflow.com/questions/22937589/how-to-add-noise-gaussian-salt-and-pepper-etc-to-image-in-python-with-opencv – Nuzhny Feb 25 '19 at 08:54
  • One simple approach might be to get the contours of the lines (which are points) and add some noise to the point locations on the contours. Also pen strokes don't have perfectly sharp edges, so you'd probably want some minimal amount of blurring (though something less artificial than Gaussian). – alkasm Feb 25 '19 at 09:14
  • @Alderven, actually the code is huge, I have made the first image from a handwritting trajectory dataset. I got some points(x, y) and then drawn joining those points on a white background (used some curve smoothing algorithm to smooth the curve) – Rahat Zaman Feb 25 '19 at 15:16
  • @Nuzhny, it may not be that simple, as said in the 3rd comment, the stroke is not perfectly sharp at the edges. And also, its not of same width in all places. – Rahat Zaman Feb 25 '19 at 15:23
  • This may be the correct approach @AlexanderReynolds, You should write an answer with the code. – Rahat Zaman Feb 25 '19 at 15:24
  • I would like to, but I don't have time to right now. Either way, wanted to capture a possible suggestion in comments. I would also suggest to edit and turn your question into a [minimal, complete example](https://stackoverflow.com/help/mcve). Namely, write just enough code to create that image and no more, or perhaps write the code to generate the contours for that shape, so that others can copy/paste and work with what you've got. – alkasm Feb 25 '19 at 18:41

0 Answers0