1. A method, comprising: selecting a target patch to be filled in an image; selecting a sample patch as a candidate for filling the target patch; determining a first difference between a first area surrounding the target patch and a corresponding first area surrounding the sample patch, and a second difference between a second area surrounding the target patch and a corresponding second area surrounding the sample patch; multiplying a larger of the first difference and the second difference with a first weight factor, and a smaller of the first difference and the second difference with a second weight factor; and summing the weighted first difference and the weighted second difference as a distance between the target patch and the sample patch.