It is currently Sun Apr 28, 2024 12:46 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 3:06 pm  (#21) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
trandoductin wrote:
I am not sure what to call the function with, using what percent?
and what to do with the returned value?


1) layer
2) some "percentage" of the pixels with the highest values.

In other words, if you call it with percent=0.05 it will return the "Value" (in the sense of HSV) for which 95% of the pixels are darker and 5% are lighter. Typically you would use it with a smaller percentage (.001). Still avoids to find a white spot at 255 because you have a very small area burned out.

The opposite function to find the dark point, and the one to find the value for which 50% of the pixels are darker and 50% are lighter (what you call the grey point) are left as an exercise for the reader :)

For more info see the description of gimp_histogram in the python procedure browser.

Just for fun, how the algorithm narrows down on the value:

Attachment:
DichotomicSearch.png
DichotomicSearch.png [ 27.16 KiB | Viewed 2236 times ]

_________________
Image


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 4:10 pm  (#22) 
Offline
GimpChat Member
User avatar

Joined: Jan 10, 2013
Posts: 863
Even running the script twice (2x), the result is quite different from that of the technique shown by PatDavid
Image
The top image using the script, and repeated use again.
The from below, following the tutorial PatDavid

_________________
bbbbbbbbbbbImage
bbbbbbbbbbb Be patient, English is not my language.


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 4:23 pm  (#23) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
ofnuts wrote:
trandoductin wrote:
I am not sure what to call the function with, using what percent?
and what to do with the returned value?


1) layer
2) some "percentage" of the pixels with the highest values.

In other words, if you call it with percent=0.05 it will return the "Value" (in the sense of HSV) for which 95% of the pixels are darker and 5% are lighter. Typically you would use it with a smaller percentage (.001). Still avoids to find a white spot at 255 because you have a very small area burned out.

The opposite function to find the dark point, and the one to find the value for which 50% of the pixels are darker and 50% are lighter (what you call the grey point) are left as an exercise for the reader :)

For more info see the description of gimp_histogram in the python procedure browser.

Just for fun, how the algorithm narrows down on the value:

Attachment:
DichotomicSearch.png


I think i am slowly having a clue at the binary search part of it. If i call it with a small percentage, i get a value back that value is like using the threshold and moving it around narrowing it down until white pixels show? correct? but it doesn't tell me what those bright pixels are composed of RGB wise.
If i individual call gimp_histogram on the RGB channels I'll get those values back of where the brightest RED, GREEN, or BLUE are, but the brightest spot might not have all these brightest RGB values for example if there are spots that's pure red (255,0,0)(spot 1)
and a spot that's pure green (0,255,0)(spot 2)
and a spot that's pure blue(0,0,255)(spot 3)
and another spot that's brightest (250,240,230)(spot 4)
calling function with histogram off value will give a value for spot 4 (let's say the value is 240 for example)
calling function with histogram on red channel will give a value me spot 1 (let's say 255)
calling function with histogram on green channel will give a value me spot 2 (let's say 255)
calling function with histogram on blue channel will give me spot 3 (let's say 255)
but from all these I am really interested in spot 4 because it is the brightest, but the value of 240 doesn't give me the RGB components of (250,240,230)

I don't know if i am making any sense or not :oops:

_________________
TinT


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 4:29 pm  (#24) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
Akros wrote:
Even running the script twice (2x), the result is quite different from that of the technique shown by PatDavid
[ Image ]
The top image using the script, and repeated use again.
The from below, following the tutorial PatDavid

Which script are you using? I have a latest version(very bottom of the python post) that uses luminosity to detect those black/white/gray points.

Manually is a little different too since you do have a choice of sample average which case you're selecting a bunch of pixels and making that white as supposed to the script which only finds 1 pixel that matches.

Plus with manual, if i do it i might choose a different patch of white which might produce different result from yours as well.

Here's a comparison of the latest version of python script that uses luminosity to find those points (very bottom) compared with your version of script run and manual.
Attachment:
scripttwice.jpg
scripttwice.jpg [ 802.38 KiB | Viewed 2219 times ]


What i still don't understand is why running it twice give different result than once. I thought if i ran it once the back pixel is already made black and white already made white and gray already made gray so there should be no change from running it twice but it does on this image and it's tripping me out

_________________
TinT


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 6:04 pm  (#25) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
Yet, the fact that the script produces different if ran twice bugged me. Maybe because the script is trying set black/white/gray points all at once.

So I changed the script to do it like Pat in his tutorial, first set the white point, then set the black point, then set the gray point last.
So this script is 3 times as slow (because it detects white point first then sets levels to that white point, then detects black point then sets levels to that black point then detects gray point and set levels to that gray point) but it does produce a different result, and running it multiple times does not change your result (so i am happy with that fact because it shouldn't).

Here's the script (yet another version to experiment with)
Attachment:
color-correction-3steps.zip [1.66 KiB]
Downloaded 107 times


here's a sample run on the shark (and running multiple times doesn't change the result)
Attachment:
anotherversion.jpg
anotherversion.jpg [ 126.56 KiB | Viewed 2215 times ]


another full comparison
Attachment:
compare.jpg
compare.jpg [ 284.05 KiB | Viewed 2211 times ]

_________________
TinT


Last edited by trandoductin on Tue Jun 10, 2014 8:52 pm, edited 1 time in total.

Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 7:30 pm  (#26) 
Offline
GimpChat Member
User avatar

Joined: Jan 10, 2013
Posts: 863
trandoductin wrote:
Which script are you using? I have a latest version(very bottom of the python post) that uses luminosity to detect those black/white/gray points.

I am using the first version of python... :roll:
I just somehow not noticing the new updates. :oops:
trandoductin wrote:
So I changed the script to do it like Pat in his tutorial, first set the white point, then set the black point, then set the gray point last.
So this script is 3 times as slow (because it detects white point first then sets levels to that white point, then detects black point then sets levels to that black point then detects gray point and set levels to that gray point) but it does produce a different result, and running it multiple times does not change your result (so i am happy with that fact because it shouldn't).

Manually do in steps 2 or 3, does not change the result.
I generally detect white point and black first. (once)
Then adjust the levels of these points.
After then repeat for the gray.

With the current results, the script is already an aid in the removal of color casts.

_________________
bbbbbbbbbbbImage
bbbbbbbbbbb Be patient, English is not my language.


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 7:47 pm  (#27) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
not too sure about this image though
i think it made it a little too blue
Attachment:
oceantooblue.jpg
oceantooblue.jpg [ 1.45 MiB | Viewed 2204 times ]

full original (while the original is not blue enough).
Attachment:
originalocean.jpg
originalocean.jpg [ 1.18 MiB | Viewed 2204 times ]

maybe a 50% opacity of layer that script ran on produces a nicer lighting.
Attachment:
ocean50percent.jpg
ocean50percent.jpg [ 1.39 MiB | Viewed 2204 times ]

_________________
TinT


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Tue Jun 10, 2014 8:10 pm  (#28) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 3975
Location: Canada
And in this photo, the script totally messed up the colors (hence experimental)
Attachment:
flowermessedUp.JPG
flowermessedUp.JPG [ 3.81 MiB | Viewed 2202 times ]

here's the original full
Attachment:
originalflower.JPG
originalflower.JPG [ 3.28 MiB | Viewed 2202 times ]

I am guessing the photo doesn't have a grayish point so when it sets the closest color to gray everything goes out of wack
But if i do it manually(right) the result is subtle but it's there compared the original(left)
Attachment:
manualflower.JPG
manualflower.JPG [ 539.81 KiB | Viewed 2197 times ]

_________________
TinT


Top
 Post subject: Re: Color Correction Script (experimentation, very slow)
PostPosted: Wed Jun 11, 2014 2:22 am  (#29) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
trandoductin wrote:
ofnuts wrote:
trandoductin wrote:
I am not sure what to call the function with, using what percent?
and what to do with the returned value?


1) layer
2) some "percentage" of the pixels with the highest values.

In other words, if you call it with percent=0.05 it will return the "Value" (in the sense of HSV) for which 95% of the pixels are darker and 5% are lighter. Typically you would use it with a smaller percentage (.001). Still avoids to find a white spot at 255 because you have a very small area burned out.

The opposite function to find the dark point, and the one to find the value for which 50% of the pixels are darker and 50% are lighter (what you call the grey point) are left as an exercise for the reader :)

For more info see the description of gimp_histogram in the python procedure browser.

Just for fun, how the algorithm narrows down on the value:

Attachment:
DichotomicSearch.png


I think i am slowly having a clue at the binary search part of it. If i call it with a small percentage, i get a value back that value is like using the threshold and moving it around narrowing it down until white pixels show? correct? but it doesn't tell me what those bright pixels are composed of RGB wise.
If i individual call gimp_histogram on the RGB channels I'll get those values back of where the brightest RED, GREEN, or BLUE are, but the brightest spot might not have all these brightest RGB values for example if there are spots that's pure red (255,0,0)(spot 1)
and a spot that's pure green (0,255,0)(spot 2)
and a spot that's pure blue(0,0,255)(spot 3)
and another spot that's brightest (250,240,230)(spot 4)
calling function with histogram off value will give a value for spot 4 (let's say the value is 240 for example)
calling function with histogram on red channel will give a value me spot 1 (let's say 255)
calling function with histogram on green channel will give a value me spot 2 (let's say 255)
calling function with histogram on blue channel will give me spot 3 (let's say 255)
but from all these I am really interested in spot 4 because it is the brightest, but the value of 240 doesn't give me the RGB components of (250,240,230)

I don't know if i am making any sense or not :oops:


If you need the points that are about white, then first use gimp_by_color_select_full to select pixels wil little color (selet on color white, and use SELECT_CRITERION_S with a low threshold (so you are selecting only pixels with a very low saturation value). Then gimp_histogram will only apply to selected pixels and whatever comes out is the value of the brightest gray pixel so its color is (value,value,value).

_________________
Image


Top
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Slow Change Kaleidoscope

7

No new posts Attachment(s) Legacy Mosaic in Gimp 2.10 because GEGL's version is so slow

10

No new posts Attachment(s) GEGL Color Light Fusion (12 blend modes for color overlay)

9

No new posts Attachment(s) Background color chanage and typed text color change

8

No new posts Attachment(s) Color does not exactly match color in GIMP 2.10 (SOLVED)

9



* Login  



Powered by phpBB3 © phpBB Group