-3
$\begingroup$

Color-slicing transformations that detect green wood sorrel leaves within an RGB cube. enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ This post is at risk of being closed because it does not include a question. Please state the question, and explain all relevant details. Include any code you have tried. $\endgroup$
    – Szabolcs
    Nov 26 '21 at 16:26
2
$\begingroup$
img = Import["https://i.stack.imgur.com/qeQfj.jpg/qeQfj.jpg"];

ImageApply[If[#[[2]] >= Max[#], #, {0, 0, 0}] &, img]

enter image description here

Alternatively, remove red and blue channels if green channel value is the maximum of the three channel values:

ImageApply[If[#[[2]] >= Max[#], #[[2]] {0, 1, 0}, {0, 0, 0}] &, img]

enter image description here

$\endgroup$
1
$\begingroup$

Not the transformation you are looking for but Mathematica has a ColorsNear function:

img = Import["https://i.stack.imgur.com/qeQfj.jpg/qeQfj.jpg"]
ColorDetect[img, ColorsNear[Darker@Green]]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.