1. A method for generating a high dynamic range (HDR) image from a set of multiple input images, each input image being assigned a bracket index, comprising: (a) dividing each input image into a set of tiles, wherein all images are divided into the same set of tiles; (b) determining a reference bracket index for each tile of the set of tiles, comprising: (b1) defining an objective function as a function of a set of bracket indices for the set of tiles, the objective function including a component that measures exposure quality of individual tiles and a component that measures correlation between neighboring tiles; and (b2) calculating a set of reference bracket indices for the tiles that optimizes the objective function; (c) based on the set of reference bracket indices for the tiles, detecting ghost-inducing pixels in the set of input image on a tile-by-tile basis by comparing, for each tile, each input image whose bracket index is not the reference bracket index with the input image whose bracket index is the reference bracket index, and generating a ghost map for each input image which indicates ghost-inducing pixels in that image; and (d) generating a HDR image using the set of input images and the corresponding ghost maps.