How to replace a certain ROI with another image?
Hello,
I am making a simple app that was built from the face detection sample of the OpenCv4Android SDK. Basically my goal is to overlay or replace the detected face with another image like a smiley or a face of a dog, etc.
I tried to use copyTo(Mat dest) where dest is a submat of the entire image (basically the detected face region) and the Mat from which copyTo is called is the image to overlay or replace. This doesn't work though.
Can someone provide alternatives? Or maybe my understanding of copyTo is wrong? Hoping for some advice. Thanks and best regards,
CODE THAT I USE - for clarity -
Mat capturedImage = Highgui.imread(<path/to/captured/image>)
Mat selectedArea = capturedImage.submat(mDetectedFace) //mDetectedFace is a Rect object
Mat replaceImage = Highgui.imread(<path/to/replacement/image>)
replaceImage.copyTo(selectedArea);
Highgui.imwrite(<path/to/save/directory>, capturedImage)
do you want to superimpose an image over the face?
@pocahentez did you even read the other posts? I think it is very clear that he wants to segment the face and replace it with another image. This could be seen as superimposing yes.
you can be inspired from this project :http://www.mediafire.com/?3wd897cpwu0s1pa.
this project allows to detect the eyes and insert images of fire there. it's not a java code.
How to find the mDetected rect object from the detected face... please anyone help to solve it.