Dirty backgrounds are something that most of us have had to deal with at some point. Sometimes, all we need to do is clean the background. Other times, it's actually better to do a full background replacement. The full replacement can be as subtle as eliminating shadows and sensor dust or something as drastic as changing the background color. In this tutorial, we go over an easy, but precise, way to do this.
First, we select the blue channel and duplicate it to create an alpha mask (a mask that exists in the channels tab and can be accessed easily at any time). Next, we use levels to increase the contrast of the mask, while still maintaining clear separation from our subject and the background (this is very important). Third, we use the lasso tool to fill the background with white and the subject with black. Then we burn the shadows and dodge the highlights to create a more defined edge. Occasionally, on certain parts of the image, you may need to manually paint black or use the pen tool to select and fill.
Once you have your cutout in place, Cmd+click on the alpha mask to load it into a selection. Then create a solid color fill layer, and click OK. Your mask will automatically be loaded in. To see what's underneath, make that layer invisible by clicking on the eye next to the layer, and re-open the dialog to adjust the color. Use the eyedropper to select an existing background color. The resulting color should be very close and this should do a nice job of evening out the background. To replace the background with a different color completely, you can simply pick your custom color here, or you can try the following method that gives a little bit more control.
First, set the solid color fill layer's blending mode to "luminosity." Duplicate the solid fill layer, but set this blending mode to "color." Double-click on the layer set to "color," and select the desired hue and saturation. Double-click on the layer set to "luminosity" to control the brightness of the color.
As a final step, I oftentimes add a small amount of grain on top of everything. This helps to blend everything together. I use this method all the time, and it comes in super handy when you need a clean background!