What processing steps should I use to clean photos of line drawings?

前端 未结 3 1747
既然无缘
既然无缘 2020-12-02 14:47

My usual method of 100% contrast and some brightness adjusting to tweak the cutoff point usually works reasonably well to clean up photos of small sub-circuits or equations

3条回答
  •  青春惊慌失措
    2020-12-02 15:22

    One common way to remove the different background illumination is to calculate a "white image" from the image, by opening the image.

    In this sample Octave code, I've used the blue channel of the image, because the lines in the background are least prominent in this channel (EDITED: using a circular structuring element produces less visual artifacts than a simple box):

    src = imread('lines.png');
    blue = src(:,:,3);
    mask = fspecial("disk",10);
    opened = imerode(imdilate(blue,mask),mask);
    

    Result: opened

    Then subtract this from the source image:

    background_subtracted = opened-blue;
    

    background_subtracted (contrast enhanced version)

    Finally, I'd just binarize the image with a fixed threshold:

    binary = background_subtracted < 35;
    

    binary

提交回复
热议问题