G'MIC exercises

is possible Diffusion curve with gmic?


1 Like

Filter Solidify ?

1 Like

thanks!

Gradient Norm




My attempt to make the lines more balanced in brightness and thickness.




Remarks

I would like the lines to be more even and defined, sort of what you get from colouring book outlines; actually that might be a good filter to work on (or maybe something like that already exists…).

At the moment, there are inherent weaknesses to the gradient norm method. The two I mentioned before: uneven brightness and thickness. And a few others: thin objects such as the whiskers “double”, and tips and corners either disappear (darkened) or become less defined (rounded).

Also, if you toggle between the original sample tiger and my results, you would see that the outline is not smack dab in the middle of the edge. It ends up either on the bright side or the dark.

If you want edges to be balanced in brightness and thickness, Canny edge detection does that directly. Eg with ImageMagick:

magick tiger.png -canny 0x4+10%+30% tiger_canny.png


This has lost very fine detail, eg the whiskers. You could do multiple Cannys and combine the results.

I can’t find Canny in the G’MIC docs. Perhaps it isn’t available.

@Stampede asked about Mixer [PCA] and I gave an uninformed answer.

I know people who frequent this thread can do better than that. :slight_smile: Additional thoughts:

1. I was curious what the command would be in CLI and so output the command to the layer name. :thinking: The command is kind of lengthy; are those values for the gradients?

[G'MIC] Mixer [PCA]: fx_mix_pca 0,0,0,-1.5,0,0,-1.5,0,0,0,3,248,98,2325.2000000000003,111.79512900164166,114.29732606890039,67.953656912764956,2315.6918711327867,1198.1961603337977,1119.5840052975143,1198.1961603337977,1460.9525680609997,972.14804576863651,1119.5840052975143,972.14804576863651,1028.2088564317926,0,50,50

If so, they don’t require user input at all. Should they belong to the argument list?

2. It would be great if we could get a rgb2pca and pca2rgb, though I don’t know if that is meaningful or useful. If anything, it would be an educational demonstration on how to get to and back from 3 PCA components.

3. I guess the input for PCA manipulation isn’t limited to RGB. It could be any number of channels, right? Does the number of input channels correspond to the number of PCA components we get? Or could we decompose the input image to any number of components, sort of like split_details?

Apologies for asking so many questions, especially when many of you are busy people. I hope I don’t tempt you away from your important work. :stuck_out_tongue:

@afre , if you have ImageJ on your computer, you can try the 3D Color Inspector/Color Histogram plugin for ImageJ.Here is some help for the plugin, but the help was written, before the PCA functionality was added (see second hyperlink).

With this plugin for imageJ, you can make the color distribution within different 3D-color-spaces visible. With this tool, maybe it is more easy to understand whats going on.

The nice thing of the G’MIC “Mixer [PCA]” filter is that you also can shift and rotate (the color distribution) in 3 directions. That isn’t possible with the imageJ plugin.

This G’MIC mixer is useful in images that have a narrow color distribution, like faded images or images with color cast. With help from the PCA you now have the right directions within the color distribution to work with. So now, I don’t have to think about RGB or AB, that’s extreme helpful for lazy people like me :smile:. In this PCA directions now you can shift in case of color cast (second slider) and widen the color distribution (first slider) to have more color-contrast between the opposites of the PCA direction. With the third slider you can rotate the color distribution around one of the PCA “axes”. The other two PCA opposites will rotate, not the colors on the axis. Therefore it seems a little bit strange, but with this in mind, it is more easy to work with.

You can also use this mixer to make the color distribution smaller (with first slider). Then there will be less color contrast within the PCA axis . You can also shift with second slider to color grade your image.

I hope this information is useful. If it is wrong on some places, other people here can correct my information. :wink:

2 Likes

I wish to do a distortion of the degrade from the difference of two image

I think that using the difference between source_gseg and target_gseg can distortion source_gpos and obtain target_gpos

2 Likes

I think that it can paint with colours the “morph layers” distorsion

A version to reverse of this:
https://www.imagemagick.org/Usage/mapping/#distortion_unified

1 Like

@garagecoder, just to thank you again for your wonderful noise_poissondisk command. That’s my new favorite weapon in my arsenal. I use it all the time, it’s so convenient to get a random spatial sampling uniformly distributed like this ! :beer:

1 Like

I’ll try my hand at making a Cubehelix filter after probing Color.js’s README on GH for stuff about colour spaces. It’s not quite as easy as splitting channels and binding them to sine waves.

Interesting, you might want to start with the matlab code - it probably needs very little modification for the gmic math parser.

1. What is the best way to input all of the sample images? My lazy way is

gmic repeat 100 sp done remove_duplicates

2. animate messes up the aspect ratio of images. How can I prevent that? E.g., if I do

gmic repeat 100 sp done remove_duplicates animate 2000

I was thinking of a different method entirely which involves splitting the channels but this might work. The Matlab code does seem a little tricky for me to understand though. I can sort out the if and for stuff just fine but I’m unfamiliar with matrices in G’MIC. map looks like it’s initially a two-dimensional matrix of zeros and I have no idea how it works. The stuff in the if structure is also difficult for me to understand. I also have no idea how vectorN works.

Mind you, I’ve found an extension of Cubehelix which allows for interpolation between any two different colours. It’s quickly becoming something that I don’t think that I can do because of how much technical stuff it requires.

Maybe $ gmic repeat 40 sp "$>" done
(but you have to remember there are 40 sample images right now, and this may be extended in the future)

This is something I have to fix ASAP, I guess :slight_smile:

hi, i-m new on this. i want to use ebsynth and dont know how to make the target gpos. do you know how can i use it to create this. Thank you so much. any advice?

@bazza me encataria hablar contigo, veo tus trabajos y es muy interesante lo que haces. he intentado entender un poco como crear la diferencia entre los gsec para crear el gpos. Cualquier ayuda o tip seria muy util para mi. muchisimas gracias de antemano.

gracias :smiley:

parece que lo genera usando algun tipo representación de un “flow” es como una transformación de una imagen a la otra. logre crear una versión usando deepmatch y deepflow no es igual, pero da buen resultado, pense que gmic podria hacer algo así.

Following up with my exploration of gradient_norm here and here

As I am having fun with G’MIC, I have been noticing that the appearance of gradient_norm heavily depends on the size (and contents) of the image.

This is a problem because what works for a small image won’t work for a large one. E.g., when I apply the same command to PlayRaw images, it doesn’t work because I have been playing with G’MIC sample images, which tend to be much smaller and more idealized.

One approach might be to resize the image. Take sample flower for example. The difference between #1 and #2 is that I doubled the size of #2 before applying gradient_norm and shrinking it back to size. (Actually, #1 vs #2 of flower might not be the best example; it still looks okay.)

With this strategy, I am able to thin the outline. So, I now know that I can manipulate the width of the outline by doing this. However, the details and intensities change resulting a different effect on the image, and this would compound as you chain more commands.

2 Likes

You’ve given me an idea for multi-scale gradient norms - I’ll see what I can do.

1 Like