Gimp-Forum.net

Full Version: Pixel selection by rule
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi GIMPers,
I’m a scientist working on the colour of seafood. I want to get the average RGB value of the tissue I’m working on, but have it not be influenced by non-muscle tissue (fat) and not be influenced by specular reflection pixels. I’ve used the “select by color” tool to reasonably good effect (see attachments. "6 modified" is after processing, "6_cropped" is the input file), but it requires human input to select the color (around which range pixels will be selected) and the threshold (of how tight the range is). This is not adequate though for high-throughput sample processing, and not reproducible (from human decisions as above). I would like a script which:
1. Isolates the sample from the background
2. Removes pixels associated with non-muscle tissue and specular reflection pixels
3. Calculates average RGB values for remaining pixels
Step 2 could be based around a rule like: Make pixels transparent if R/G/B value lies outside “range specified by user based on color picking analysis of RGB values of unwanted pixels”.
My girlfriend coded one in Python (Github link: https://github.com/aspiringutilitybot/Pi...-of-inputs ), but I thought a GIMP script would be useful.
Gimp is really designed for human interaction.There are plenty of libraries out there for advanced image processing, in particular OpenCV. This is a very popular package and you'll find books, tutorials, and many questions/answers on StackOverflow.