I'm using Mathematica for most of this work. And what the code below illustrates for me is how important the UI is. Colors and Images are first class objects that we can manipulate both programmatically and in a manual style. It's possible to mix and develop both kinds of workflows together. In this case I'm getting the major colors to get a rough mask of the black stain.