BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.23k stars 4.61k forks source link

How to get the difference between two image to generate a new image? #2434

Closed WhistlingArrow closed 7 years ago

WhistlingArrow commented 7 years ago

Now I have a problem: If there two picture, I want to get the difference between these two picture to generate a new picture.(On Mac, Photo Booth App have this feature)

The differences means the differences of contents of two images.For example, one image's content is my room and the other image's content is my room with I am sitting in a chair, the new image's content is just I without any other thing.

BradLarson commented 7 years ago

By "difference", do you mean a subtractive blend?

If so, create two GPUImagePicture instances and a GPUImageSubtractBlendFilter. Target the two GPUImagePictures at the GPUImageSubtractBlendFilter. Run -processImage on both and the blend will produce a pixel-by-pixel subtraction of the two, in the order that they are provided as targets.