Open
Conversation
Author
|
Hi @jorgensd, It seemed like chapter 3 would be the best place for this? Thanks again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This demo was originally proposed for the DOLFINx main demo repository, but following maintainer feedback, it is submitted here as a more application-focused example. This PR adds a demo illustrating the smoothed total variation (TV) image inpainting using DOLFINx. The example consideres a sythnetic image defined on the unit square with an irregular interior mask, and reconstructs missing data using a nonlinear variational formulation.
Starting from a variational inpainting model from Chan and Shen, we define the energy functional:
Where the first term enforces data fidelity on know regions, weighted with$\beta$ , on the know regions with mask $m$ , and the second term is a smoothed total variation regularization inspired by Rudin, Osher, Fatemi, weight with $\alpha$ :
The smoothing parameter$\varepsilon>0$ in introduced to make the TV term differentiable, enabling the use of Newton methods (second order).
Taking the Euler-Lagrange equation associated with$J(u)$ yields the nonlinear PDE:
Which leads to the weak formulation: find$u\in V$ such that:
The demo includes:
Notes
The example is intended as a tutorial style demonstration of using DOLFINx for nonlinear variational problems in imaging. Further extensions could be added such as solving for F, the weak form with ufl.derivative, although I'd prefer it remain explicitly in terms of the weak form to emphasize the connection between the mathematical model and its implementation.