what is h in the formula for w(p,q)?
@PandaX The equation for the weight is no more than a Gaussian. h is analogous to what you would typically see in the denominator of the exponent in a Gaussian (which is the variance if we're talking about a random variable with a normal distribution). Here, it is a parameter that determines the bandwidth of the kernel function, as in how wide/flat the bump is.
Small bandwidths give high weights to patches that are close to patch p in Euclidean distance and low weights to patches with large Euclidean distance to patch p.
What does it mean for h to go to infinity? That would mean all patches in the search region, regardless of distance from patch p would get the same weight.