Description
The greyscale version looks for the sequence of black lines stacked on top of a white background that will most closely approximate the original image. The color version separate the image into channels and repeats this for each channel.
For example, suppose I have black AND white lines on a grey background.
When the lines are to be combined in the finished image, I want to add line A to stack B.
Some white might be on top of some black and vice versa. Note that it might not be strictly white-black-white-black-etc.
Lines are not woven together - a new white string cannot be under previous white strings.
It is a convenient property that two lines only cross at a single point.
The test "is line A better on top of topmost-B?" is pretty quick to calculate... but wrong.
Sometimes the answer is indeterminate (lines are parallel, non-intersecting, or equal better-ness).
Sometimes it would be better to put A under some B lines, because the total error is lower than A being above all B. eg, some error might be permissible. How much? I don't know. Aye, that's the rub.