As I found a very interesting need over at PDN forum, the challenge is to extract shapes with error margins. Some theory on solving this problem is use areas, gradient angle, inpainting to extract shapes. But, that may or may not be enough and especially with large error margin.
The challenge is to extract shapes using this image:
repeat $! l[$>] to_rgb rgb2hsv channels 0 tones 2 k. erode 5 dilate 5 +area_fg 0,0 f. i>ia?0:i store. area +gradient2rgb , +f. i>0 compose_channels. + f. i>0 negate. inpaint_pde.. . rm. rv +blend shapemedian0 blend[^-1] shapeaverage0 blend average n. 0,255 rgb2hsl sh. 1 f. i>0?1 rm. hsl2rgb $area n. 0,360 +f. i0#1>0?1 . a[^0] c hsv2rgb. blend interpolation,.5 endl done