0
$\begingroup$

I have a set of line art drawings, which I have cleaned and colored (flood fill). I want to remove the original line art from the images and to leave only the colors.

This image illustrates pretty much what I want:enter image description here

All of my line art is of a solid black, without anti-aliasing, and at high resolution. The resulting image has all black pixels replaced by nearby colored pixels. Colored pixels from the original image are left untouched.

I made a rough Python program to generate the "after" image. Notice that the colors are offset to the right and bottom of the original black areas (which causes distortion of my shapes when the line art has varying width). Also, my program is very slow; hence, I'm looking for a smarter solution to this problem.

Edit: An algorithm similar to those used to compute the morphological skeleton of the image's black pixels will greatly improve this operation.

$\endgroup$

1 Answer 1

1
$\begingroup$

I have a couple of solutions, but I have not test either of them for you image.

I. Use simple neighrest neighber interpolation, i.e.

  1. sweep through whole pixels,
  2. Check if the ith pixel is black (threshold it, or get its HSV transform, whatever)
  3. if it's black, substitute colour values of its nearest non-black neighborer, in the pixel.

II. Using Medial filter,

Simple apply a medial filter on the image, but do not count black pixels when applying on each window of image.

$\endgroup$
2
  • $\begingroup$ The median filter solution works better than other alternatives I tried in the meanwhile. Thank you! $\endgroup$
    – Locoluis
    Jul 6, 2017 at 4:21
  • $\begingroup$ @Locoluis , you'r welcomed, but remeber the conventional medial might not work for all point, so modifies so as to ignore the black pixels in the process. $\endgroup$
    – MimSaad
    Jul 6, 2017 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.