Switch to full style
Post a reply

Equalize local histograms commandline not working

Tue Jan 02, 2024 9:02 am

Hello all,
I intent to integrate a few G'mic filters into an open source tool hosted on github that is used for post processing astrophotography images in the next version (called LuckyStackWorker). It is used for solar system images obtain using a technique called 'lucky imaging'.
In particular I found Ian's noise reduction to be very effective, I'm using this filter for years already from Gimp. Also the "Equalize local histograms" filter works very well for revealing fine details when used from Gimp. Ofcourse I will clearly refer to G'mic in the about menu and use the same naming for the filters.

For the integration I use the CLI, however when executing the command, the resulting output seems to be (nearly) the same as the original input image:

gmic -v 2 -input temp_in.tif -div 65536 fx_equalize_local_histograms 75,2,4,100,8,0,16,0,50,50 -mul 65536 -output test.tif,int16

Note that the input image is a 16-bit tiff as well as the output. In order to make it work for Ians noise reduction I had to first divide and multiple by 65536. This works fine for Ians noise reduction, so I'm assuming that it will be the same for "Equalize local histograms".

I tried all kinds of different things, like change the strength value to 0.75, use a different channel (Luminance instead of Lightness) and pretty much all the other parameters, with no luck. Changing other parameters then strength does have an effect, but it is as if the most important parameter strength is ignored.

Does anybody have an idea how to make it work from the CLI? (as it does when used directly from Gimp that is).

NB: forgot to mention the version of gmic cli that I use is the latest as of now: 3.3.2

Re: Equalize local histograms commandline not working

Tue Jan 02, 2024 12:42 pm

After some more experimenting I discovered that using a lower value for "regularization" actually made the strength value more effective. When setting it to 4 instead of 8 (the default in gimp) the effect of increasing the strength is close to what it looks like in gimp. Still its somewhat odd that the values differ.
Anyway I'm very pleased I got this one working as well, I haven't seen any other filter that is able to bring forward the faint details so effectively!

Re: Equalize local histograms commandline not working

Tue Jan 02, 2024 4:16 pm

I use GMIC from the CLI alot. I use the 'stand alone' version of GMIC. Start it from a cli and open an image. It's gui of course but I get the exact GMIC command that worked best shown in the cli. I paste that into a batch script. In the cli the command comes-up as 'Apply'.

To do what you want to do you need to bundle GMIC in some form with your app or at least have it as a dependency. Its possible too make custom filters in GMIC and save them. This seems identical to what you are doing.

Re: Equalize local histograms commandline not working

Wed Jan 03, 2024 2:33 pm

Thanks @Tas_mania. It works great now on windows. I discovered that there's even a macos version of the cli (simply installed using brew install gmic).
I need to figure out how to bundle it on the mac though, it seems less obvious then in windows. Plus the fact that it needs to work on both intel and arm processor adds to that complexity.

Re: Equalize local histograms commandline not working

Wed Jan 03, 2024 6:50 pm

Hi, I had these links on another computer.
https://paulsphotopalace.wordpress.com/2016/07/07/create-your-own-gmic-filter-for-gimp-part-i/
https://github.com/GreycLab/gmic-commun ... ic-plug-in

I use a '.gmic' text file in the home directory. I'm glad I did this because not long after a favorite filter was dropped but I still use it. The 'testing' branch of the filters changes a bit and the main filters also. Overall progress has been positive in the G'MIC world. Most filters work on V3 from the cli but not all.
Post a reply