I'm trying to replace a manual process done in PhotoShop with an automated process done on the server. Currently in PhotoShop the "Color Range" tool is used to select a range of colors using the "Fuzziness" factor and starting with either Black or White depending on the part of the process.
My initial approaches included both using thresholds for Luminescence in the L*a*b color space as well is DE94 between the candidate color and Black/White. In both cases I selected colors that shouldn't be selected and/or didn't select colors that should.
My hunch is that I should be using cones instead of spheres for my selection.
Can anyone give any insight into what PhotoShop is doing and if I'm heading the right direction? Also, if there is a library out there to do this that would be awesome I'm currently writing this in C.
To use the Color Range command, choose the Select > Color Range menu option. You’ll see the Color Range dialog appear: The most flexible way to use Color Range is in the “Sampled Colors” mode (choose from the drop-down box). Click with the mouse in the document window on an area of your image that contains the colour you want to select.
Color Range is a great choice of selection tool when the area you wish to select is distinctively different from the other colors within the image.
The Select Option. We can select pixels that share the same or similar color just by clicking on an area of that color in the image. Photoshop "samples" the color we clicked on and selects all of the pixels that are the same as, or within a certain range of, that color (hence the name "Color Range").
To use the Color Range command, choose the Select > Color Range menu option. You’ll see the Color Range dialog appear: The most flexible way to use Color Range is in the “Sampled Colors” mode (choose Sampled Colors from the Select drop-down box).
From what I have seen in Photoshop, the algorithm could probably be similar to the following:
If you only want to select certain pixels, then instead of applying the effect directly at the pixels in the image you could store the falloff values in a matrix of double
s in range from 0.0 to 1.0. Then, choose a threshold value above which you will select the given pixel.
For example, if the step 2. for pixel at the coordinate (x, y) yielded 0.8 and the step 3. yielded 0.5, then the value of the matrix element with coordinates x and y should be 0.8*0.5=0.4
. If you picked a selection threshold below 0.4, you would select pixel (x, y), otherwise, you would not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With