I am using Imagemagick to create an automatic chroma key removal program. I have been successful in creating a mask for the image using the following commands:
magick convert woman.original1.jpg -colorspace HSL -channel Hue,Saturation -separate +channel ( -clone 0 -background none -fuzz 7% -transparent #575757 ) ( -clone 1 -background none -fuzz 0% -transparent #4a4a4a ) -delete 0,1 -alpha extract -compose multiply -composite mask.png
Using this code, I have been able to create the following result:
However, as you can possibly notice, the mask misses out part of the hair, which as can be observed in the original image, is slightly tinted green. When I extract the hue channel, the following image is generated:
As you can see, the hue channel also shows that the hair takes on a green hue.
How do I preserve the hair while removing the green chroma key?