Is it possible to mask out unsharp areas of footage with After Effects?
As you may know from 3d packages depth information can be represented by a 2d Depth Map:



In therory it's possible to detect the defocused area of an image via depth estimation methods and generating a depth map using this information. The algorithm splits up the image by finding all relevant edges, analizes the gradient values and compare these areas with each other. I doubt that this is accurate enough for every shot, but could work in some cases. One of the latest papers, you can find here:  http://www.sjzhuo.net/defocusEstimation/

AFAIK there is only one available plugin for After Effects at the moment: http://www.yuvsoft.com/stereo-3d-technologies/automatic-depth-estimation/, but since this process is becoming increasingly important for stereoscopic workflows, it's a matter of time when more tools will become available.