I am trying to use the GPUImagePoissonBlendFilter of a GPUImage structure to mix two faces in my blending application. Here is my code.
- (void)applyPoissonBlendToImage:(UIImage *) rearFace withImage:(UIImage *) frontFace { GPUImagePicture* picture1 = [[GPUImagePicture alloc] initWithImage:rearFace]; GPUImagePicture* picture2 = [[GPUImagePicture alloc] initWithImage:frontFace]; GPUImagePoissonBlendFilter * poissonFilter = [[GPUImagePoissonBlendFilter alloc] init]; poissonFilter.mix = .7; poissonFilter.numIterations = 200; [picture1 addTarget:poissonFilter]; [picture1 processImage]; [picture2 addTarget:poissonFilter]; [picture2 processImage]; finalResultImage = [poissonFilter imageFromCurrentlyProcessedOutputWithOrientation:rearFace.imageOrientation]; }
ie As you can see, I give two images (rearFace and frontFace) as input for this method. The front face of the image is a shape (a polygon shape formed by connecting the relative position of the eyes and mouth) and is the same size as the back image ie (to fit the size, I filled the space external to the polygonal shape with a transparent color when drawing) .
However, the confusion does not occur as I expected. that is, the sharp edges of the front surface do not mix with the rear surface. Here my assumption is that the PoissonBlendFilter starts mixing the second image from the upper left corner, and not from the upper left face.
Problem: I feel that the input image does not feed into the filter correctly. Do I need to apply some kind of masking to the input image? Can anyone guide me on this?
ios objective-c gpuimage opengl-es face-detection
Minna zacharias
source share