Deformation (warped fill)

There is an interesting G’mic Function called “Square to Circle”.
Is there the possibility to have an equivalent “Square to any Shape” (provided as a second layer in input)?
By equivalent I mean having the important feature of warping accordingly the content of the source (square).
Goal: have texture images (square patterns) with which filling irregular parts (colour areas) of a posterized image adjusting the texture structure to the borders of each area.
Thanks

Bonjour @dinasset

Can you give an example of the form (second layer in input).

Depending on the form, I believe it is easily achievable with distortions as consequences.
You can also do it directly in Gimp (Python or Script-Fu).

:o)

Merci Sylvie.
My objective is always to have a mean to simplify the creation of a mosaic Roman style.
For instance, let’s assume you have a seamless stone pattern like this (approx):TEXTURE
and you want to obtain a mosaic like this:


Obviously I can’t “pretend” from that filter the capability to create “broken” stones to fill certain little spaces, the important is the capability to orient and distort (and scale a bit when necessary) the pattern to fill each colour area prepared by the main filter “calling” the hypotetical G’mic filter.

Sorry if I didn’t create an example by hand, but the arthrosis in my shoulders does not let me draw easily.

@dinasset

I’m sorry, but that’s not what I understood at all :o(

Merci pour votre intérêt, Sylvie.

This seem to have potential to work with: https://github.com/yobeatz/mosaic

But, as noticed, I already tried translating python to gmic and failed to complete it, so it may not work out.

Also, a workaround could be Krita. It now has a mesh warp tool.

Thanks Reptorian.
Yes, looking at the sample output it’s what I’m looking for.
Unfortunately I don’t know how to make out of that set of files a Gimp Python filter (and you didn’t in porting them to G’mic).
Maybe someone else could give a try.
Thanks again

It takes a lot of time to create filters like this for g’mic. Partly why I want more gmic developers here, so I wouldn’t have to spend as much time to port filters and get closer to my dream of a complete toolset that replaces pdn plugins.

1 Like

For me, the kernel idea stems from following a contour. See Blur by Color, a yet-to-be-reconstituted tutorial. Scroll down to " 4. Following Contours".

Rough outline of an idea. Start with a simple line drawing:
selfportrait_epicycle
Goal: a field of specific impulses (2 channel image). Each impulse encodes the sine and cosine of an orientation angle. Harness this to orient a tile sprite (a chip in the overall mosaic).
inpulse

Derive this orientation from -structuretensors which detects edges and calculates orientations. Something like:

gmic                                \
   -input selfportrait_epicycle.png \
   -r2dx 20%,5                      \
   -normalize. 0,1                  \
   -oneminus.                       \
   -threshold. 50%                  \
   -distance. 1                     \
   - structuretensors.              \

gmic_000001

   -eigen.                          \
   -rm..                            \
   -resize. 500%,500%,[-1],[-1],1   \
   [-1],[-1],[-1],[-1]              \
   -noise_poissondisk 10            \
   -mul

This carries the rough idea through a field of impulses encoding orientation angles that align with edges originally found by -structuretensors. Sorry: don’t have the bit on rendering tiles. `Tis a working day and meetings are coming up. Binning this field-of-impulses image out into 5 degree increments for fifteen separate binary [0,1] impulse image channels, then, for each, convolving over the impulses with a suitably rotated tile texture, then summing or otherwise blending the fifteen channel images into the output is the follow-up outline. -structuretensors tends to make colorwheel like structures; the centers of these colorwheels are points where tiling can be awkward. A mosaic artist would probably drop a chip over the point and call it a day.

Aye. There’s the rub.

It’s hard to beat di Blasi’s java app for rendering these. I managed to come close with G’MIC as you know, Diego, but still I’ll admit I like di Blasi’s Java app output more. Someone re-compiled to allow higher rez for me and I shared that compile jar file (guy deleted his profile and I have no way to attribute him doing this for me, unfortunately) at link below. :slight_smile:

http://gimpchat.com/viewtopic.php?f=11&t=18050&p=260021&hilit=mosaic#p259671

Look forward to how you did your outline grosgood. Hope you don’t mind a bit of di Blasi play textured using G’MIC’s Local Orientation preset. :slight_smile:

1 Like

@Reptorian

Thank you for the link.
The ‘Yobeatz/mosaic’ program is fine.
Here is a test with ‘gmicky’ with default values.

Well done for the creations of @grosgood and @lylejk

:o)

Sylvie, I suppose you ran the ‘Yobeatz/mosaic’ python as standalone (it’s Python3).
Do you think it’s possible to derive from that a Gimp Python filter?
(Gimp I guess is still using 2.7).

@dinasset

The ‘Yobeatz/mosaic’ program is activated with a simple command line from the terminal, for example :
python.exe mosaic.py

I believe that it is possible to activate this program from Gimp 2.10 by taking inspiration from https://samjcreations.blogspot.com/2020/09/est-une-bibliotheque-image-libre-tres.html

I used Anaconda to test ‘Yobeatz/mosaic’. It is relatively big and there is perhaps a simpler method.

:o)

Thanks, but are you saying that it could be called from inside a gimp plug-in written in python? (just to be more specific: with something similar to a call of another plug-in?)

PS: as you know, I write plug-ins in python which I then distribute on Gimpchat, that’s the reason of my question

@dinasset

… it could be called from inside a gimp plug-in written in python?

Yes :
http://gimpchat.com/viewtopic.php?f=9&t=18040&start=20#p256055

just to be more specific: with something similar to a call of another plug-in?

I never had this idea. It is to try.

:o)

<offtopic warning>
Hand drawn. Inspired by 3Blue1Brown’s But what is a Fourier Series? The trick to the game is to make a line drawing, but not lift the pencil from start to end - and not cross the path. Transform that single curve line drawing to its spectral equivalent, where each spectral point furnishes the size and initial angular position of a wheel, and whether the wheel rotates clockwise or counterclockwise. Except for the root, on the origin, the center of each wheel coincides with the end of the single radial spoke of the parent. Each wheel of the so-constituted wheels-within-wheels mechanism rotates at some integral multiple frequency of the root, that multiple coinciding with the wheel’s spectral coordinate. Clockwise or counterclockwise stems from whether the spectral point coordinate is above or below the Nyquist frequency. So positioned, the wheels-within-wheels ‘mechanism’ also draws the contiguous line when it is set in motion - the last wheel has a pen attached, rather than another wheel.
It is a lot of silly fun, draws the connection (literally) between the temporal and spectral domains - and was rendered with Python - not G’MIC
</offtopicwarning>


Think I’m free for the rest of the day. Maybe I can finish the thought on this mosaic tiling game…
2 Likes

Excellent Etch-a-Sketch simulation, G. :slight_smile: