I am trying to incorporate skin detection as well as viola jones object detection in my application for accurate detection of hand. I am using JAVACV
this is what i am trying to do
SkinImage = detect.skin(InputImage);
This will return an image with skin regions marked as white and all other regions as black, binary image
After this i would like to AND the "SkinImage" and "InputImage" from which i should get an image with only skin regions visible in skin colour and all other regions blacked out like applying a binary mask to an image. So the question is how do i AND these two images??
I know it can be done in C++ with SkinImage &=InputImage;
How can i do it in JAVA using JAVACV or other libraries like ImageJ
In ImageJ, you can do the following to apply a mask to an RGB image:
import ij.ImagePlus;
import ij.plugin.ImageCalculator;
[...]
ImageCalculator ic = new ImageCalculator();
ImagePlus imp3 = ic.run("AND create", imp1, imp2);
with imp1
and imp2
being instances of the ImagePlus
class, imp1
being the original image (e.g. RGB) and imp2
being the binary mask image.
To get this code, I was running Process > Image Calculator... while running the macro recorder (Plugins > Macros > Record...) in Java mode.