How do i diff two images in Photoshop?
March 7, 2006 1:31 PM Subscribe
In Photoshop, how can I easily extract the only difference between two pictures? Imagine two pictures of the same room. In one of the pictures however, there's also a vase on the table. Is there an easy way (meaning with lasso or magic selectors) to extract the vase? Meaning is there a filter of some sort that would basically treat the identical areas of the two pictures as green screen? I tried adding a difference layer, but it doesn't work properly.
For the difference layer to work, it would depend on the two layers being identical except for the vase, which is unlikely unless the vase was artificially composited into the layer to begin with. If it's just two photos shot from the same angle, even on a tripod, then difference probably won't get you what you want.
But if the two layers really are identical in every respect except for the vase, then your technique will work. You just need a few more steps. Difference probably gave you something that looked like a mostly black image with a grey vase-like shape in the middle. If you copy that composited blended layer, and push the contrast, you can use it as a mask to select only the vase.
posted by Jeff Howard at 1:43 PM on March 7, 2006
But if the two layers really are identical in every respect except for the vase, then your technique will work. You just need a few more steps. Difference probably gave you something that looked like a mostly black image with a grey vase-like shape in the middle. If you copy that composited blended layer, and push the contrast, you can use it as a mask to select only the vase.
posted by Jeff Howard at 1:43 PM on March 7, 2006
Or, a simpler way (with less precise results) would be to just use the magic wand to select the gray area. Then, while keeping the selection, turn off the difference blending. Hit copy to copy just the vase.
posted by Jeff Howard at 1:45 PM on March 7, 2006
posted by Jeff Howard at 1:45 PM on March 7, 2006
cillit bang has the right idea but there's more to it than that. It's actually quite a long and complicated process. You take the 'difference' image that results, and turn that into a layer mask which you then apply to the image with the object in it. I tried writing down a walkthrough but it is too complicated to do it verbally.
posted by unSane at 1:53 PM on March 7, 2006
posted by unSane at 1:53 PM on March 7, 2006
Best answer: Yes, the difference mode is the way to do this, keeping Jeff's point in mind. In film/video, this technique is called a "Difference Matte," and it's not widely used, because it usually doesn't work all that well. However, if you still want to try it, here's what to do:
1) Open the no-vase image and press F7 to bring up the Layers Palette.
2) Open the vase image and, holding down SHIFT, use the Move Tool to drag it into the no-vase image (the SHIFT key will ensure that the vase image is centered).
3) The vase image should now be the upper layer in the no-vase document. Change it's blend move (at the top of the layers palette) from Normal to Difference.
This will make everything turn black EXCEPT for whatever is different in the two images -- i.e. the vase.
4) With the magic wand tool, click any black pixel. All the black pixels will become selected.
3) From the menu, choose Select > Inverse. Now just the vase will be selected.
4) Press Command+J (PC: Control+J) to copy the selected vase to a new layer.
5) Set this layer's mode to Normal.
6) Drag the middle layer (the original vase layer) to the trash.
Hint: Learn how to use Quick Masks. They will help you deal with the problem that Jeff mentioned.
Also, You may want to insert a step 3.5 in which you choose Select > Feather from the menu. Add a small amount of feathering (transparency around the edges of the vase), maybe 1.5 pixels. This will help the vase blend into the background a bit better.
posted by grumblebee at 2:05 PM on March 7, 2006
1) Open the no-vase image and press F7 to bring up the Layers Palette.
2) Open the vase image and, holding down SHIFT, use the Move Tool to drag it into the no-vase image (the SHIFT key will ensure that the vase image is centered).
3) The vase image should now be the upper layer in the no-vase document. Change it's blend move (at the top of the layers palette) from Normal to Difference.
This will make everything turn black EXCEPT for whatever is different in the two images -- i.e. the vase.
4) With the magic wand tool, click any black pixel. All the black pixels will become selected.
3) From the menu, choose Select > Inverse. Now just the vase will be selected.
4) Press Command+J (PC: Control+J) to copy the selected vase to a new layer.
5) Set this layer's mode to Normal.
6) Drag the middle layer (the original vase layer) to the trash.
Hint: Learn how to use Quick Masks. They will help you deal with the problem that Jeff mentioned.
Also, You may want to insert a step 3.5 in which you choose Select > Feather from the menu. Add a small amount of feathering (transparency around the edges of the vase), maybe 1.5 pixels. This will help the vase blend into the background a bit better.
posted by grumblebee at 2:05 PM on March 7, 2006
Incidentally, Scott Kelby's fantastic PS Channels book has just been released.
It has a number of techniques for doing difficult selections.
posted by Caviar at 2:42 PM on March 7, 2006
It has a number of techniques for doing difficult selections.
posted by Caviar at 2:42 PM on March 7, 2006
This is also called "Adjacent frame difference" (AFD) in computer vision. It's used for exactly the situations you describe -- when you have something that's moving against a fixed background, then you can "erase" the background. If the cameras are fixed, this technique should work fine.
posted by zpousman at 6:41 PM on March 7, 2006
posted by zpousman at 6:41 PM on March 7, 2006
This thread is closed to new comments.
posted by cillit bang at 1:40 PM on March 7, 2006