A well-known technique in high dynamic range (HDR) imaging is to take multiple photographs, each one with a different exposure time, and then combine them to produce an HDR image. Unless the scene is static and the camera position is fixed, this process creates the so-called "ghosting" artifacts. In order to handle non-static scenes or moving camera, images have to be spatially registered. This is a challenging problem because most optical flow estimation algorithm depends on the constant brightness assumption, which is obviously not the case in HDR imaging. In this paper, we present an algorithm to estimate the dense motion field in image sequences with photometric variations. In an alternating optimization scheme, the algorithm estimates both the dense motion field and the photometric mapping. As a latent information, the occluded regions are extracted and excluded from the photometric mapping estimation. We include experiments with both synthetic and real imagery to demonstrate the efficacy of the proposed algorithm. We show that the ghosting artifacts are reduced significantly in HDR imaging of non-static scenes.