It is currently Wed Jun 03, 2026 8:32 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: little questions to Garry (or David)
PostPosted: Sun Sep 28, 2014 3:42 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Hello Garry!

When ou wake up, after your coffee (American or Italian?), I have a little question for you:

- is it true that special G'MIC variables like 'ia' cannot be specified with a reference to a specific image, for instance: ia[-2] ?

I ask that because in a filter I'm experimenting nowadays I wanted to get the average value (ia) not of the current layer/image (layer in gimp terms, image in g'mic terms), but of the previous one; no way (for me) to let G'MIC accepting ia[-2], hence I was obliged to do the following:
-reverse[-2,-1]
then, after that command I could use ia without any specification and I could access ia of layer/image -2
Am I correct or could I have done something different to access directly that ia?

Thanks a lot

(btw, I plan to let open this topic for anyone willing to ask little questions concerning G'MIC)

_________________
"Where am I ?"


Last edited by dinasset on Tue Sep 30, 2014 2:16 pm, edited 1 time in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: little questions to Garry
PostPosted: Sun Sep 28, 2014 7:43 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
To get something related to an image that is not [-1], you can use '@{ind,expr}' instead of '{expr}',
so in your case :
mean=@{-2,ia}


Top
 Post subject: Re: little questions to Garry
PostPosted: Sun Sep 28, 2014 7:51 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Many thanks, David, I didn't like to use the reverse command!

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry
PostPosted: Sun Sep 28, 2014 11:01 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Gracious. Ronounours has come up for air. Could this mean release 1.6.0.1 is imminent?

Ah well. Whatever the case, it leaves me with little to do other than answer the question about coffee: American. On occasion Italian, but I suspect it bears only a tenuous relationship to what Italians might recognize as coffee. We Brooklynites have a way of transforming other peoples' cuisines...

Garry


Top
 Post subject: Re: little questions to Garry
PostPosted: Sun Sep 28, 2014 1:26 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Hello Garry,

And thanks again for all the hard answering work you're doing on the various G'MIC forums :cheers !

I'm currently working on 1.6.0.1, yes, and more precisely, I'm hunting a bug that makes the plug-in segfault in some cases.
After that, I'll release another beta with the 'Colorize Comics' filter integrated into GIMP (tomorrow, I hope).
So, still many things to do before an official release !

Cheers,

David.


Top
 Post subject: Re: little questions to Garry
PostPosted: Sun Sep 28, 2014 7:36 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4826
Location: Bendigo Vic. Australia
David please let me know when you update 1601 and I'll create win64 files for testing on GimpChat, if Lyle doesn't break it, it must be OK :hehe

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Sep 30, 2014 2:26 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Here another small question from me:
- is there in G'MIC (or is it more or less easily implemetable) a filter to de-haze a picture in a way similar to Kolor > Neuthalhaser product (commercial, not free)?

I post here an example (having downloaded a demo version of that software):

original:

Attachment:
example-05-haze.jpg
example-05-haze.jpg [ 2.34 MiB | Viewed 5158 times ]


modified (just an example: there are sliders to adjust to taste)

Attachment:
example-05-haze_KOLORtest.jpg
example-05-haze_KOLORtest.jpg [ 2.65 MiB | Viewed 5158 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Sep 30, 2014 3:36 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Hello dinassett,

-normalize_local comes to mind. start with:

-normalize_local 32,64

The command (1) finds local minima/maxima, and (2) estimates a local adjustment so that all local minima/maxima peak/trough (more or less) at the same value. The second parameter, radius, establishes the size of a 'locality' The first, amplitude, a relative strength. Too small a radius will render the hazed distance as if overly sharpened. Too large a radius and the haze is not fully attacked. Adjust to taste.

Garry

--Edit--
Ah. For the Gimp-centric out there, this lives in the G'MIC plug-in under "Details->Local normalization." The Gimp filter applies the -normalize_local command to a wide selection of channels, defaulting to luminance. GRO


Last edited by grosood on Tue Sep 30, 2014 3:59 pm, edited 1 time in total.

Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Sep 30, 2014 3:50 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks Garry, tomorrow (it's almost 11 pm here) I will try.
(btw, I did already use that command but with very small amplitude, to sharpen an image....let's see with your suggested values)

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Sep 30, 2014 4:17 pm  (#10) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Yep. `tis getting dark here on the North American eastern seaboard. Winter approaches.

Cautionary: if you play with this through Gimp (see afterthought edit), it is almost impossible to preview correctly, as the preview skews the size of the neighborhood. One winds up finding the ideal settings for the preview, which do not quite work for the image at large. One pretty much has to ignore the preview, accept the arguments blind, hit 'OK' and undo edit if the arguments aren't ideal.

Garry


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 5:45 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Garry,
as promised I did some experiments (using the same input image) applying normalize_local filter.
In my results I noticed:
- your proposed values (32,64) seem to be the best ones
- I had to modify the default smoothness values, increasing them to 32 and 40, otherwise the resulting image looks "blocky"
The effect is very similar to the one produced by the mentioned commercial package.
Thanks again.

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 10:56 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Haze can be tricky. Here's a paper from Microsoft Research from about five years ago which furnishes a nice survey of the problem:
Single Image Haze Removal Using Dark Channel Prior
You're allowed to skip over the math, just read the abstract and conclusions.
I won't claim that -normalize_local is a panacea for all hazy problems. This Wikimedia Commons shot of the Kuala Lumpur skyline during an extreme inversion would be tough to deal with with any package. Haze erases information that cannot be restored in any case. With luck maybe you can make what remains of the data somewhat pretty.
Original:
Image
normalize_local & color rebalance (amplitude of 38, radius 64)
Image
Best attempt here. Not sure if this qualifies as pretty, but it gave me an excuse to give you a variation series of my own.

Garry


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 11:53 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
A quick go, Arrays & tiles / Tiled random shifts, New layer, Overlay.
[G'MIC] Tiled random shifts : -gimp_shift_tiles 1,1,0,1

Image

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 12:01 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Apr 07, 2010
Posts: 14182
Normal and Screen Modes

Image Image

_________________
Image


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 12:03 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Nice game, here is my attempt :

Attachment:
3506_klh-0_dehazed.png
3506_klh-0_dehazed.png [ 237.59 KiB | Viewed 2731 times ]


Used Anisotropic smoothing + local normalization + Lab color mixer, all G'MIC filters :)

David.


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 2:13 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
..and now topic change, a new little question:
which is the best command (or list of commands) in G'MIC to perform the colour manipulations available in GIMP LEVELS??
There you may "move" the 3 magical "points" (black - mean - white) -not only manually but also using the corresponding command (gimp-levels) in script-fu.
Let's consider just the mean (the "ia" in GMIC); how can we "move" it either towards black or towards white when needed such that all values between "im"(minimum value) and "ia" are "normalized" between 0 and USER-MEAN-GOAL and values between "ia" and "iM"(maximum value) are "normalized" between USER-MEAN-GOAL and 255?
Thanks Garry and David!

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Wed Oct 01, 2014 5:19 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
OK, Bub. Gotta answer. But it's gonna cost you.

Odinbc, Molly, and Ronounours have got a nice roll going on here, so you can't just walk in
with the idea of stopping it with a question. I don't care if you were the one who started the thread.
We've taken over.

So put up your own variations. That's right. Clear the haze in Kuala Lumpur. Or make it worse.
In any case, make it interesting. Do whatever you want, so long as it involves G'MIC, either straight
up (command line) or a G'MIC Gimp filter.

Then maybe I'll spring an answer - or Ronounours. But coloring between the lines seems to have enraptured
him of late. Probably started at an early age with his first box of Crayolas.

Garry :D


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 02, 2014 2:39 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
...hehehe...
here my attempt, using both GIMP and GMIC
mainly 3 steps:
1) GIMP Levels (so you see the power of it!)
2) GMIC Normalize local (2,10,7,40,0,0)
3) GIMP blur using a mask to operate mainly on the sky

Attachment:
3506_klh-0_GIMPlevels+GMICnormloc+GIMPmaskedblur.png
3506_klh-0_GIMPlevels+GMICnormloc+GIMPmaskedblur.png [ 307.18 KiB | Viewed 2701 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 02, 2014 5:11 pm  (#19) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Hello dinasset,

Thank you for joining the game, and Thanks, be to Odinbc, Molly, Ronounours and you, Dinasset for your contributions. I like them all, the different directions they went in, and none like I would have proposed. I'm particularly fond of Molly's sun-breaking-through. And oddly, Ronounours reminds me of the winter "No'easter's" common to this part of the world and an intrinsic piece of my childhood. These arise from intense low pressure systems following the gulf stream up the North American Atlantic coast. This, being the Northern Hemisphere, the airmass twirls around these lows counterclockwise, lifting moisture-laden air from the Atlantic Ocean and carrying them inland to New England, the wind blowing in from the northeast from the offshore low pressure system. These would give rise to two or three days of drear. Somehow, Ronounours hit just the right shade of gray in the sky, and, from the anisotropic smoothing, some of the lighter building trimming assumed the aspect of piling-up snow - at least to me. I suppose that goes to show that what we see in an image is often what is already in our minds --
- :hoh -

Oh? Right! Yes. dinasset asked a question, didn't he? I seem to have digressed. What was the question, now? No matter. I'll give an answer. And if it happens not to fit the question that dinasset asked, well, it will fit the question that dinasset should have asked.
Image

There are three g'mic commands which, singly or in combination, relate to Gimp's Adjust Color Levels dialog box: -cut, -normalize and -apply_gamma.
To help relate G'MIC's world to the Adjust Color Levels, I've marked the two slider controls with 5 indices. These produce five numbers, which I call C1 to C5.
In terms of G'MIC-speak, Gimp's Adjust Color Level does three operations, two which relate directly to corresponding G'MIC commands, the last to simple combinations of them. These are:
  1. Gamma Correction. Compares to G'MIC's -apply_gamma command.
  2. Range Rescaling. Compares to G'MIC's -normalize command.
  3. Gamut Rescaling. Emulated by G'MIC -cut and -normalize commands.
Here's a handy little gray scale generator in G'MIC command line script.
$ gmic -input 512,512,1,1,'x' -normalize[-1] 0,255 -round[-1] 16 -cut[-1] 0,255 -output[-1] grayscale_16.png

which makes a grayscale that looks like this:
Image
Gimpers may copy most these commands, excluding -output and its argument, into one of the G'MIC command interpreter filters nestled in the Various branch, say 'custom code (local)'. Set the output mode to 'New layers', erase the demo code there and paste the grayscale generator code in its place. Hit 'OK'.

You can load this into Gimp and follow along with it. Each bar is 16 levels brighter than the one to the left, except for the rightmost bar, which has been truncated from 256 down to 255; the extreme left and right bars happen to be at half width (8 pixels) compared to the interior ones (16 pixels wide).

Gamma Correction
The middle slider in the Adjust Color Levels dialogue box, C2 corrects for gamma. Here's the transformation relationship from original pixel intensities (i) to new pixel intensities (i')
-Image -

where C2 is the value one gets by adjusting the middle slider.
The analogous G'MIC commands are:
$gmic -input grayscale_16.png -apply_gamma[-1] <C5> -display[-1] -output[-1] gamma_adjust.png

The argument given to the -apply_gamma command is the same as the slider value "2" obtained from the Adjust Color Levels dialogue box. The G'MIC -display command place a window on your screen which you can examine by hovering the mouse over select pixels. Compare with those obtained from using the Adjust Color Level dialogue box.

Range Rescaling
The two Output Level slider controls, C4 and C5 can serve as the arguments for a corresponding G'MIC normalization command. Here's the transformation relationship from original pixel intensities (i) to new pixel intensities (i')
-Image-

where C5 is the value one gets by adjusting the right hand Output Level slider, and C4 is from the left hand slider.
The analogous G'MIC commands are:
$gmic -input grayscale_16.png -normalize[-1] <C4>,<C5> -display[-1] -output[-1] normalize.png

The arguments given to G'MIC's -normalize command correspond to the C4 and C5 sliders from the Adjust Color Levels dialogue box.

Gamut Rescaling
The two Input Level slider controls, C1 and C3 manipulate an image's gamut. C1 maps its given value to zero. This, and all values less than this become zero. Correspondingly, C3 maps its given value to 255. This, and all values greater than this become 255. The facility rescales the values between C1 and C3. The transformation relationship from original pixel intensities (i) to new pixel intensities (i') is:
-Image-

The corresponding G'MIC operations are:
$ gmic grayscale_16.jpg -cut[-1] <C1>,<C3> -normalize[-1] 0,255 -display[-1] -output[-1] gamut.png


As an aside, there is a button on the Adjust Color Levels which will bring you to Color Curves, preset to carry out the comparable Levels operations. Indeed, the Curve Tool is fundamental in that it can emulate nearly every other operation on the Color menu. It is also interesting to perform G'MIC operations on a standard scale like grayscale_16.png and then study the results through the curve tool with an eye toward what Gimp operations might produce analogous changes that the G'MIC command wrought.

Hopefully, you've got your money's worth for your fee of adjusting one Kuala Lumpur weather inversion. Take care.
Garry


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Fri Oct 03, 2014 4:49 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
Garry,

thanks for your exhaustive answer!
So, first of all, I place the result of using only GMIC commands to your challenging photo:

Attachment:
3506_klh-0_GMIC-ONLY.png
3506_klh-0_GMIC-ONLY.png [ 296.8 KiB | Viewed 2651 times ]


for this I used:
-cut 48,176
-normalize 0,255
-apply_gamma 0.85
-normalize_local 1,16,4,32

(but now, for my personal satisfaction, let me post also the result of a script implemented by myself utilising gimp_levels...

Attachment:
3506_klh-0_GIMP-DIEGO-autolevels.png
3506_klh-0_GIMP-DIEGO-autolevels.png [ 267.6 KiB | Viewed 2651 times ]

here, the haze was not removed (no command included for that), but I like better the colour nuance
probably, to reach an equivalent "colour-tone" in the GMIC only version, I would have to add separate GMIC commands for each channel R, G, B

========================================================
edit (at 9 pm)
playing on the single channels (R G B) I get this:
Attachment:
3506_klh-0_GMIC-ONLY-on-channels .png
3506_klh-0_GMIC-ONLY-on-channels .png [ 332.5 KiB | Viewed 2642 times ]

========================================================
This done, I will use next post(s) to "drill-down" the gimp-levels topic..

_________________
"Where am I ?"


Last edited by dinasset on Fri Oct 03, 2014 2:03 pm, edited 1 time in total.

Top
Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group