Photoshop lets you easily select the areas/pixels of an image that are in focus. 

Do the following:

  1. With the image open in Photoshop, choose Select > Focus Area. In the Focus Area dialog box, you can make changes to the default selection.
  2. Adjust the In-Focus Range parameter to broaden or narrow down the selection. If you move the slider to 0, the entire image gets selected. However, if you move the slider to the extreme right, only the parts of the image in clearest focus remain selected.
  1. Use the brush controls to manually add () or remove () areas from the selection.
  1. If the selection area has noise, control it by adjusting the Advanced > Image Noise Level slider control.  

Note:

You can leave the Auto option selected for In-Focus Range and Image Noise Level. Photoshop automatically selects appropriate values for these parameters. 

  1. At any point, while making changes to the Focus Area selection, you can toggle the Preview option to see the original image.
  1. If necessary, select Soften Edge to feather the edges of the selection.
  2. If you want to fine-tune the selection edges, click Select and Mask.
  1. Once you've adjusted the selection to your satisfaction, determine whether the refined selection should become a selection or mask on the current layer, or produce a new layer or document. You can choose one of the following output options:
  • Selection (default)
  • Layer Mask
  • New Layer
  • New Layer With Layer Mask
  • New Document
  • New Document With Layer Mask
  1. Click OK.