# Patch priority and its effect on Criminsi's Exemplar Based Inpainting

I am trying to implement exemplar based in-painting, as proposed by Criminsi et. al. in its original format (before moving into further optimisations).

I have a few theoretical doubts which I would like to clarify.

I am not sure how the patch priority and the determination of fill-order works to propagate linear structures into the user-selected target region.

From what I understand, Criminsi suggests the following:

1. Determine the fill front dΩ.
2. Compute the patch priorities [C(p)D(p)] on patches lying on the fill front.
3. Propagate texture into the patches - in order of their patch priorities.
4. Update confidence values.
5. Re-compute fill front dΩ from the remaining unfilled section.

[Repeat these 5 steps till all of the target region is filled].

Now, if this understanding of the algorithm is correct (and, please do correct me if the interpretation is wrong), I have the following doubt:

• If I'm always filling patches from the fill front only, and if the patches are fixed in their spatial location (w.r.t other patches on the fill-front), then I don't see how the order of filling-in matters. The patches are filled in by direct sampling of the source region, which stays constant for all iterations. Hence, I do not understand how the order of filling will result in any pixel level difference on the propagated textures. From what I gather, the best match from the source region should remain unaltered, irrespective of the order. What am I missing here?
• Based on this video (and assuming it is correct), the patch filling does not always occur on the fill-front only. How does this work? Does this mean we are to compute the priorities for all patches in the target region at once and go on filling them based on their priorities? Then, how does the fill-front determination matter and why does Criminsi determine dΩ at all? I understand Criminsi's approach was a step ahead of the traditional onion-peel technique. But how, exactly?

I really wish to clarify these questions before I delve into 2-3 days of intense coding.