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