Revision history [back]

If you have the ROI-coordiantes of the mouth, then you could apply warpAffine only onto that. Example:

// x0,y0,x1,y1 are the bounding coordinates of your mouth-region
// of course the same could be achieved with cv::Rect()
cv::Mat mouth_roi(whole_image, cv::Range(y0,y1), cv::Range(x0,x1));
// don't know if warpAffine works in-place, but give it a try:
cv::warpAffine(mouth_roi, mouth_roi, M, mouth_roi.size());


If that doesn't work you have to apply warpAffine to a different destination matrix and copy it back to mouth_roi. If they have different sizes it's getting slightly more complicated but the principle is the same.