Algorithm 5: Nonlocal pixel exchange

Input: Original image f, pixel mask c, size m of candidate set, the set K of pixel indices of the mask c.

Initialization: u := r(c, f) and cnew := c.

Compute: Repeat

(i)Choose randomly m |K| pixel indices i from J\K and compute the local error ei := (ui fi)2.

(ii)Exchange step:

Choose randomly a j K and set

For the largest value of ei, set

(iii)Compute unew := r(cnew, f ).

(iv)If MSE (u, f) > MSE (unew, f )

u := unew and c := cnew.

Update K.

else

Reset cnew := c.

Until no pairs can be found for exchange. ...

Get Variational Methods now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.