Ghosts always appear in the multiexposure fusion for dynamic scenes. Most of the existing deghosting methods require complicated and subjective parameter settings, easily resulting in many artifacts. A robust exposure fusion method that removes ghosts while preserving the details of the image is presented. The proposed method first detects the motion area by bidirectional intensity mapping and calculates the motion weight. Then, the latent images are generated by weighted optimization in gradient domain, and ghosts are removed automatically. After removing the ghosts, fusion weights are calculated using a patch-based fusion method, and exposure fusion is performed with details retained and outlier values suppressed. Experiments show that the proposed method can remove ghosts effectively, which demonstrates strong robustness to ghosts in a variety of circumstances. It also avoids influence from complicated and subjective parameter settings.