For many who want to remove a background from an image, they are using some form of 'green screen' behind an object. Comparing a control pic which contains no objects with one with an object in it work fairly well, but things like shadows throw the comparison off because they are different enough from the base colour that a larger 'fuzzy' value is required. The trouble with that is that a large enough value to include shadows tends to also include parts of the object. The shadow problem gave me an idea, though. Shadows on a single-color plane, while being different from the base colour in absolute value, are (pretty much) identical in their RGB ratio. For example, light blue-grey and dark blue-grey both have the same 86%/86%/100% RGB ratio. While using ratios won't work as well as the gradient color replacement, it should be easier to implement.
Parameters would be
- Colour: The base colour.
Range Min, Max: Sets the minimum and maximum values (absolute or percent of base colour values) for the search range, based on the largest of the RGB values.
{Ratio}: (Optional) Three numbers that set the RGB ratio. Used if the base colour values aren't optimal. If percent signs are used, the two smaller values are expressed as percentages of the largest.
{X, Y}: (Optional) If used, search is local to location and stopped by any borders. (i.e. non-matching pixels.) If not used, search is global, and any matching pixels in the whole image are selected.