Anyway this type of algorithm could be implemented in G'MIC?

ref: https://www.publicdomainpictures.net/pictures/180000/velka/great-horned-owl-eyes.jpg

Toying with distance transform (under contours) to get a smoother placement of the dots like the first article I originally mentioned. Does help, but not the same as the results in that article. That said, just another reason to post here. lol

:slight_smile:

1 Like

And here’s the Mickey example. Note how the dots appear to be more flowing. I dup, run distance transform (normalize preset) and set opacity to 50% and copy visible to create the layer that will be the mask. I run Pack Ellipses and then run alpha to selection and toggle the selection mask and copy/paste to create the mask which I use to colorize the dots based on the original. :slight_smile:

3 Likes

Could not understand why distance transform gave such cool smooth placements of the dots but then it dawned on me that it’s the gradient transitions. For the dot mask this time, I dupped, ran Sharpen [gradient] and set the top layer to grain extract and merged down. That layer I auto-equalized and smoothed to taste before creating the dots (keeping this result for later use as well). Then I created a mask out of the dots (selection by transparency toggleing the selection mask then copying to clipboard) and pasted and used the mask to colorize the original. I then blended the created dots layer with this new one (overlay to taste) and voila. Still, for solid colors, the patterning using the distance transform gives better results, imo. Even so, now the result is much sharper and smoother if you will, imo. I know; it’s just that I’ve been going dotty for quite some time (David knows; lol). :slight_smile:

3 Likes

Edge aligning using gradients

My take on the rose:

gmic oellipse.gmic sp rose,1024 oellipse. 30,3,2.5,1,7  o. rose.png

Strong edges tend to orient better than soft-focus photographs:


Base image

gmic oellipse.gmic e_letter.png -blur_linear. 2,0,60 -d , -oellipse. 30,3,2.5,1.1,7 o. e_letter_oe.png

Never pass up an opportunity to foist yet another Goudy 1911 Bookletter ampersand on an unsuspecting world.


Base image

$ gmic oellipse.gmic amper_01.png r. 200%,200%,100%,100%,5 oellipse. 30,3,2.5,1,7  o. ampersand_ellipse.png
oellipse.gmic
#@cli oellipse : Spacefill a surface with edge-aligning ellipses; edges
#@cli : derived from selected images. 1. median factor: preprocess.
#@cli : blur neighborhoods with low local variance; force edges across
#@cli : boundaries between high variance. Larger ⇒ greater effect.
#@cli : 2. ellipse size. Larger ⇒ bigger ellipses.
#@cli : 3. edge sensitivity: lower admits only the most prominent edges.
#@cli : higher detects more edges. Too many edges and orientation is
#@cli : less clear.
#@cli : 4. Spread: Larger ⇒ spreads ellipses at greater step sizes
#@cli : along normals to edges.
#@cli : 5. Search passage count: Larger ⇒ increases the number
#@cli : of passes to find empty spaces to stick ellipses. Each pass
#@cli : tries to fit ellipses with 1/2 the radii of the previous pass.
#@cli : My image is black : Result of not finding edges. Try increasing
#@cli : median and/or edge sensitivity. Try pre-sharpening the image.
#@cli : It takes forever and a day to run!: Yep. Try fewer passes; smaller
#@cli : images. ≈5 minutes on 1024×1024 RGB with 7 passes. Later passes
#@cli : take longer. This with a Xeon(R) CPU E5-2630 v4 @ 2.20GHz running
#@cli : one thread (this toy does not multi-thread).
#$cli : $ image.jpg oellipse. 30,3,2.5,1,7  o. image_ellipse.jpg

oellipse: -skip ${1=10},${2=1},${3=3},${4=1.1},${5=1}
   mfac=$1
   efac=$2
   esen=$3
   sprd=$4
   rcnt=$5
   -name. img
   +luminance.
   -name. gray
   -median[gray] $mfac
   -newtile[gray] $esen,$efac,$sprd,$rcnt
   -name. mask
   -blend[img,mask] shapeaverage0

#@cli newtile : Make a partition (tiling) map of an image.
newtile:
   -check "${1=3}>=0 &&      \
           ${2=1.0}>=0.05 && \
           ${3=1.5}>=0.25 && \
	   ${4=1}>0"  
   -echo[^-1] "Creating a partition map of selected images."
   edgesen={$1/100}
   tsize={$2*0.025*sqrt(w^2+h^2)}
   spread=$3
   rcnt=$4
   -name. metric
   -remove_opacity[metric]
   -gradient_norm[metric]
   -blur[metric] 1
   -ge[metric] {$edgesen*abs(iM-im)}
   -distance[metric] 1
   +gradient. xy
   -append[-2,-1] c
   -vector2tensor.
   -name. orienter
   [-1],[-1],1,1,[-1]
   -name. plottingfield
   -repeat $rcnt
      -echo "Pass\ "{$>+1}
      [metric]
      -name. truedistance
      -round[truedistance] {$spread*$tsize}
      -fill[truedistance] ">
                             abs(i-j(1,1,0,0,0,1))>"{0.5*$spread*$tsize}"?
                             1: abs(i-j(1,0,0,0,0,1))>"{0.5*$spread*$tsize}"?
                             1:0"
      0
      -name. pstack
      -eval[truedistance] ">
               if(0<i(x,y),
               da_push(#$pstack,[x,y,$tsize,$tsize,$tsize]);
               run('plot_ellipse'))"
      -remove[truedistance]
      -if w#$pstack==0
          -echo "Plotting field seems filled"
          -break
      -else
	   tsize:=0.5*$tsize
	   -remove[pstack]
      -fi
   -done
   -keep[plottingfield]
   -fill[plottingfield] i(x,y)==1?255:0

plot_ellipse:
   cx,cy,er,pw,ph:=da_pop(#$pstack)
   offw={round($pw/2,1,0)}
   offh={round($ph/2,1,0)}
   rad={round($er/2,1,0)}
   estats={V=I(#$orienter,$cx,$cy);eig([V[0,2],V[1,2]])}
   +crop[plottingfield] {$cx-$offw},{$cy-$offh},{$cx+$offw},{$cy+$offh},2
   -name plotspot
   -if (ia#$plotspot)<-0.875
       -ellipse[plottingfield] $cx,$cy,$rad,{0.75*$rad},{es=[$estats];rad2deg(atan2(es[3],es[2]))},1,1
       -echo "Plot Ellipse: "$cx,$cy
       -echo "Ave: "{ia#$plotspot}
       -echo "eigens: "{[$estats][0,2]}
   -fi
   -remove[plotspot]

Time to walk Vinny.

EDIT: Documented script listing.
More extensive documentation on making a partition map in Cookbook article Tiled Art. Have fun.

3 Likes

Nice read for coders, Garry. Still, I’m just a filter guy end user. lol

I know Dr. di Blasi created a cool mosaic java script but unfortunately that site, at least the last time I looked for it, no longer exists. Still, thanks to the wayback machine, you can get the java script. Someone modified it for me so I can no do hirez mosaics as well (again, not a coder). Still the executable java script is quite powerful. :slight_smile:

http://web.archive.org/web/20080409213801/http://www.dmi.unict.it/~gdiblasi/pubblicazioni/mosaic.php

And just an excuse to do a packed marbles e. lol

Also, do like the dead zones you were able to achieve with your e (well, ampersand); similar to what the first article I linked on this thread did. :slight_smile:

1 Like

Merci @grosgood

To have fun with this new ‘oellipse’ filter:

gmic.exe m %USERPROFILE%\user.gmic sp colorful samj_shapeprevalent_degradations 4,0,0,32,0,0,100,3,0 oellipse 0,3,2,1,5 fx_emboss_relief 5,0,0.4,0.9,1,1,0,0,50,50 sharpen 200 smooth 100 c 0,255 o colorful_oellipse.png

user.zip (1.9 KB)

1 Like

OK; posted the tute below on how I use distance transform to get more fluid results. :slight_smile:

Circlismic the Tutorial. • GIMP Chat