It is currently Wed Aug 12, 2026 7:56 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 07, 2014 8:22 am  (#41) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
addendum
continuing my tests, I noticed that I get better result replacing the average of the middle values with the general average (ia).
Well, someone less lazy than me could have tried to enlarge the slice to cover from 10% to 90%, thus avoiding reconsidering blacks and whites...

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 09, 2014 6:55 am  (#42) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
at this moment, in my experiments I'm using a more "sliced" series of "if", to adjust the "target" ($1 is the parameter passed to the function, $mean is the current "ia" of the image)
-----------------------------------------------------------------------------------------------
# algorythm to calculate the adjusted target (newave)
-if {$mean<$1*0.20}
newave=($mean)
-elif {$mean<$1*0.30}
newave=($mean*4+$1)/5
-elif {$mean<$1*0.50}
newave=($mean*3+$1)/4
-elif {$mean<$1*0.70}
newave=($mean*2+$1)/3
-elif {$mean<$1*0.90}
newave=($mean+$1)/2
-elif {$mean<$1*1.10}
newave=$1
-elif {$mean<$1*1.30}
newave=($mean+$1)/2
-elif {$mean<$1*1.50}
newave=($mean*2+$1)/3
-elif {$mean<$1*1.70}
newave=($mean*3+$1)/4
-elif {$mean<$1*1.80}
newave=($mean*4+$1)/5
-else
newave=($mean)
-endif
# end of algorythm
-----------------------------------------------------------------------------------------------

at this point, it would be nice to have a "formula" to calculate it based on a "gaussian" curve, instead of this stepped profile.

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 09, 2014 7:26 am  (#43) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
Hello dinasset,
You've certainly furnished enough data points to fit a curve. Busy day in store, here, and tomorrow, but perhaps I'll be able to play with toys this weekend.
Take care,
Garry

Edit: postscript -
does $mean == {ia}, the average intensity of the image?
G


Last edited by grosood on Thu Oct 09, 2014 7:36 am, edited 1 time in total.

Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 09, 2014 7:28 am  (#44) 
Offline
GimpChat Member
User avatar

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

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 14, 2014 10:50 am  (#45) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
I have another question:
- if I'm not wrong, the G'MIC "ia" value does not correspond to the GIMP "mean"
(at least, I get different values interactively)
- if the above is true, my question is: is there a "formula" to convert GIMP-mean<->G'MIC-ia values? (maybe Garry, you already explained it to me but I didn't realize)

the question arises from my experiments in using the "fixit" routine: the "user" enters a target value (default 127) having in mind GIMP, but then the apply_gamma called by fixit finds a gamma value using a "from" value which is G'MIC ia and trying to shift the image values to reach the entered target, but the latter is interpreted as a G'MIC target; the result is that I get an image with a GIMP mean much higher than 127

many thanks in advance

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 14, 2014 1:06 pm  (#46) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
dinasset,

{ia} is the mean value of the last image in the list, which means it takes the mean values of all the image data, including all channels if necessary.
I suppose GIMP does compute the mean color instead, or maybe the mean of the luminance.
G'MIC has a function to compute the average color as well : -average_color that can be used like this :
mean_color=@{-average_color[0]}


To compute the average of the luminance, you can do something like this :
--luminance[-1] avg=@{-1,ia} -rm[-1]


Hope this helps.


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 14, 2014 1:23 pm  (#47) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks, David!
I will try to make use of those info.
Because the "fixit" routine now computes the "ia" value on the image after a -to_rgb command I tought it was the colour (rgb) average.
I will change and see..

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 14, 2014 1:41 pm  (#48) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
made some tests using the console of gmic using an image which in gimp shows a mean of 78.7
- with the first technique I get 3 values: 34.73603333333333,24.14046666666667,14.74296666666667
- with the second technique I get this value:
26.91947044513226
all far from gimp mean (well, if I take the 3 values RGB and make a sum of them I'm getting close, but this doesn't make too much sense, does it ...?
Any other suggestion?
Thanks David

_________________
"Where am I ?"


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

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
new, very interesting (imo) results (concerning G'MIC"ia" and GIMP"mean" from my experiments, let me explain:

1-I prepared an artificial image made of six equivalent slices of "pastel" colours (with the term "pastel" I mean colours having each a misture of R,G and B values) in such a way to get from GIMP the mean value exactly to 127.5
2-I duplicated this image and applied GIMP function "Maximum RGB" obtaining a new different image (colours more intense); first surprise (for me): GIMP mean value stays to 127.5

hence: my first conclusion: GIMP computes the average value taking into account only the maximum value among the 3 values R,G and B

I continued my experiments and asked G'MIC to provide me its average (ia) both on the base images and on the extracted luminance of the images (David's suggestion)

3-on the initial image (pastel) I got the following data: std "ia" = 42.5, luminance "ia" = 75.0
4-on the modified image (maxrgb) I got the following data: std "ia" = 62.1, luminance "ia" = 89.4

hence: my second conclusion: it seems to be impossible establish a precise relation between GIMP mean and G'MIC ia values

...and my third conclusion: it seems to be misleading entering into a G'MIC filter an input parameter referred to GIMP values (in my case: I was trying to "shift" an image towards a new GIMP mean value -default 127-); better to set the parameter as a relative value to the existing G'MIC value e.g. 0.1-10

could be that these observations and conclusions are obvious for GIMP and G'MIC experts, but I wanted to put them here for inexperienced G'MIC'ers

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 21, 2014 5:40 am  (#50) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
a new (little) question:

-did someone ever write a tutorial on the practical uses of the various gmic blending modes?

I know there is a "formula" explanation (with examples) on the gmic wiki, but what I have in mind is something like a series of pragmatic suggestions on the uses; as an example:
- is you like to increase the color/contrast on an image one way could be: duplicate the image and blend them "softlight"
- is you like to increase the color/lightness on an image one way could be: duplicate the image and blend them "screen"
and so on

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 21, 2014 6:24 am  (#51) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
another (little) question:
-assuming a coder has to enter a long series of choices in a parameter
e.g. #@gimp : Apply a nuance = choice("Grey","Red","Orange",........)
where he intends to let the user choose among tenth of nuances,
is there a way to store somewhere (maybe in the same folder where the "gmic" file is located) a list of all these possibilities and replace the actual list in the filter with a reference
e.g. #@gimp : Apply a nuance = choice(@stored_nuance_list) ?

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 21, 2014 12:53 pm  (#52) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
No, sorry dinasset this is not possible.


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Tue Oct 21, 2014 12:56 pm  (#53) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks for the answer, David. I was hoping, but I need to survive anyhow...

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 23, 2014 10:10 am  (#54) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
another little question:

is there in G'MIC an equivalent of Gimp MaxRGB?

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 23, 2014 11:05 am  (#55) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Yes, try something like this : -compose_channels max


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 23, 2014 12:05 pm  (#56) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
thanks David
does this command require some other step?
just opening an image and trying the command on it, I get a B&W image
what do I wrong?

_________________
"Where am I ?"


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

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
post scriptum:
the Gimp maxRGB creates a colored image keeping in each pixel the maximum among the three values, id est:
if a pixel has RGB=50,78,240 it becomes 0,0,240
if a pixel has RGB=50,78,17 it becomes 0,78,0
if a pixel has RGB= 224,190,100 it becomes 224,0,0
and so on
(a special case is when two colours have the same maximum, both are kept)

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Thu Oct 23, 2014 1:20 pm  (#58) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
looked at the manual
the compose_channels does actually return a B&W image
it corresponds therefore to a maxRGB of Gimp in terms of values, but not in terms of colors
many thanks, anyhow

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Fri Oct 24, 2014 1:52 am  (#59) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14831
Location: roma, italy
David, I've written a G'MIC filter for "MaxRGB".
It's very very slow, because it performs three times the pixels scan, one for each channel.
If you like so, I can post it here.
an example:
original
Attachment:
original for maxrgb.png
original for maxrgb.png [ 46.35 KiB | Viewed 1855 times ]


G'MIC maxRGB
Attachment:
modified by maxrgb.png
modified by maxrgb.png [ 18.99 KiB | Viewed 1855 times ]


compared to Gimp maximum RGB
Attachment:
gimp maxrgb.png
gimp maxrgb.png [ 18.99 KiB | Viewed 1855 times ]


It is just only a "divertissement", because no Gimp-er needs it, being available the much much quicker Gimp filter

Just to let you know that I'm learning from you and Garry...

_________________
"Where am I ?"


Top
 Post subject: Re: little questions to Garry (or David)
PostPosted: Fri Oct 24, 2014 3:58 am  (#60) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
ha ok, so I would say :

-fill 'R=i(x,y,z,0);G=i(x,y,z,1);B=i(x,y,z,2);255*(i==max(R,G,B))'

(not tested, I'm in Madeira right now :p)


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

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group