Extracting the In-Focus Portion of an Image

    
Clean the segmentation:
Set the alpha channel: