Is there any transform, which "looks" at any region of a picture and then compares it with neighbor region, and if two regions are similarly colored, then unifies two regions in one and colors it with average color.
Finally, this transform will distinguish "paper" from "writing" on it.
It will color with constant value any gradient fields or dimmed pictures, while remain uncolored any area with frequently changed colors, like in writings.
Key idea is that this transform should allow any big color change if it is gradual.