Isolate Brown by Rgb Values [Closed]

I am looking to isolate "brown" colors by rgb values. Not just 1 brown color, but the wide spectrum of colors that are perceived as brown - tan, suede, dirt, etc.

Any ideas on how to do this? I'm thinking that maybe if Red is less than 128, and Green is between 70 and 138, and blue is less than 128, than it appears brown. Something along those lines.

A really simple heuristic would be something like, in pythony pseudocode

def isBrown(red, green, blue):

  # Kind of maximum lightness
  if blue > parameter_1
    return False

  # how green or red tinted can it be
  if absolute_value(red - green) > parameter_2:
    return False

  # Light brown is just yellow or orange
  if maximum_of(red, green) > parameter_3:
    return False
  else:
    return True

The tune parameters 1 through 3 until it works nicely. Perhaps replace if absolute_value(red - green) > parameter_2: with if absolute_value(red - green*parameter_2b) > parameter_2a: so that more greeny or reddy ones are selected depending on parameter_2b. Perhaps change maximum_of to something else. etc. etc.

It really depends what you consider to be brown. It is a colour category for which there is rather high inter-subject variability and strong contextual effects (colours next to it changes how it looks).

Think you need to use something like this: and look at the shape of the colours you decide on and then work out how to express that algorithmically.

2
Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest