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

Which means I’ll never find all my marbles. lol

Still cannot believe how G’MIC’s still the gift that keeps on giving after all of these years, David. Shared the tool everywhere I can and hope people have seen both the potential and power of it. I know I have; use G’MIC, literally, on every edit I do. :slight_smile:

1 Like

Here is a first filter implementation for the G’MIC-Qt plug-in:

located in Patterns / Pack Ellipses.
Let me know if that works for you!

3 Likes

Works great; really cool and quick and do like the options (true circlism as well as ellipsis). Hopefully can add random objects as well (future updates) to be a packed sprites on steroids. Thanks a heap again for the work, David. :slight_smile:

2 Likes

Packed glass shards

And, with a little help from Inkscape (cracked glass; wish someone would have ported Inkscape’s bitmap filters into GIMP by now; lol) and shellout, why not. :slight_smile:

1 Like

I tested on this image, and you lose some significant information from it.

https://png.pngtree.com/png-clipart/20221115/original/pngtree-fire-burning-realistic-red-flame-picture-image_6861030.png

Particularly on the alpha channel.

Not sure about using transparencies with circlism, Rep. Still, maybe a solution can be had.

Anyway, just because I cannot help myself. lol

Played around with some sliders and then added some after effects, and voila; who needs Perculator, anyway. True story; asked the creator of Perculator to port his program to Windows (probably a decade ago now) and he said, in a nut shell, that he didn’t have time to do so. I try not to hold grudges, but… lol


:slight_smile:

1 Like

There is, but for maximum flexibility, it requires a lot of care in coding. I am revisiting my photomosaic filter, and there’s like 900+ LOC as a result of so many options and making it work.

It looks really cool indeed!
It takes roughly 1:15min to process a 3000x3750 image on my macbook M1 (Ubuntu VM). I’m not sure if it’s fast or not since i don’t know what’s under the hood.

I can’t even find this any more. I can find references to IFS Illusions. This is pretty obscure.

Is it 1mn and 15s, or 1h and 15mn? :face_with_spiral_eyes:

As this filter basically creates a simplified version of the image, I’d recommend not using it on “large” images. Let say that 1024x1024 already contains enough details for the filter to proceed.
And, if you want a high resolution rendering, it is still possible to select the x2x8 resolution option in the filter for rendering the final outcome at large resolutions.

It was 1min and 15s of course! 1 hour? noooo way! :sleeping:
EDIT : tried on a 1200x1500px image and filter was applied in 11s.

I think it would be useful to have this kind of information as a note in the GUI, for users who don’t read this forum and may try the filter on huge images. But thanks anyway :wink:

1 Like

@David_Tschumperle & @lylejk
Thank you for the creation of this filter and the idea.

To have fun:

foofoo :
fx_pack_ellipses. 3,20,0,100,100,6,1,3,0,0,0,255,0,0
+fx_emboss_relief. 5,0,0.5,2,1,1,1,0,50,50
sharpen.. 200
smooth.. 100
fx_blend_edges[-1,-2] 1,5,0

2 Likes

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