Sunday, 20 September 2015

batch - How can I do automatic background subtraction with a reference image in Photoshop?


I plan on taking a series of pictures of people in a room, keeping a fixed position of the camera, and later remove the background. Essentially, although the background is complicated, it should be approximately identical in all pictures.


Since this will be a large number of pictures I am looking for an (semi)-automated way of removing the background. I was thinking to some sort of background subtraction functionality such as Macs PhotoBooth, where, based on a reference background image, it automatically detect non background areas.


How is this possible on consumer applications such as Photoshop?



Answer



Depending on how you make your photos, it can be pretty easy to impossible...


If




  • you control the lighting of the wall (it can be patterned, but makes life harder - in general a single color with even lighting is recommended)

  • there is no shadow being dropped by the people on the wall,

  • the wall color and ANY color on the people has no match (or they are not even near)

  • the camera is fixed

  • the DOF is fixed

  • the focus(!) is fixed

  • the white balance, etc. is fixed (use color calibration at the beginning)

  • and you use low ISO to avoid dots in the image,



then



  • you can take a reference photo of the wall,

  • make a photo of the people (or one person)

  • put these two images in Photoshop

  • use "Substract" on the two image layers

  • use threshold to select those points that are close to 0,

  • use the created image as a mask to mask the photo with the people


This all can be automated using batch processing. But before you do that, try it yourself manually. In general, this is not impossible, but not easy either.



You might need to mess a bit manually with masking, but if you keep to the rules above, the manual work is not so much. If you deviate from the rules above, it just gets harder and harder.


Especially around hair, this can become a nightmare, because hair works as a kind of filter, which can alter colors - this is just physics.


There is a reason why people use greenboxing/blueboxing, and even that needs good skills to produce great results (unless you go for a low-resolution output).


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...