mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-02 02:15:04 -05:00
The lineart model often outputs a lot of almost-black noise. SD1.5 ControlNets seem to be OK with this, but SDXL ControlNets are not - they need a cleaner map. 12 was experimentally determined to be a good threshold, eliminating all the noise while keeping the actual edges. Other approaches to thresholding may be better, for example stretching the contrast or removing noise. I tried: - Simple thresholding (as implemented here) - works fine. - Adaptive thresholding - doesn't work, because the thresholding is done in the context of small blocks, while we want thresholding in the context of the whole image. - Gamma adjustment - alters the white values too much. Hard to tuen. - Contrast stretching, with and without pre-simple-thresholding - this allows us to treshold out the noise, then stretch everything above the threshold down to almost-zero. So you have a smoother gradient of lightness near zero. It works but it also stretches contrast near white down a bit, which is probably undesired. In the end, simple thresholding works fine and is very simple.