# A question about PSF deconvolution

**URL:** https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108
**Category:** Astro/Space
**Tags:** question, dsp
**Created:** [June 23, 2024, 11:35am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108 "2024-06-23T11:35:08Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)
#### Post date: [June 23, 2024, 11:35am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/1 "2024-06-23T11:35:08Z")

</div>

Could I obtain the deconvolved image if I have an original image and its PSF? And if I have a deconvolved image and its PSF, how can I obtain the convolved image?

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [June 23, 2024, 11:48am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/2 "2024-06-23T11:48:31Z")

</div>

Convolution, see for images

> **[Convolution | Discrete convolution](https://en.wikipedia.org/wiki/Convolution#Discrete_convolution)**
>
> For complex-valued functions f, g defined on the set Z of integers, the discrete convolution of f and g is given by:

is basically. a matrix multiplication, so your second part is relatively easy.  
The inverse operation is not uniquely determined, you are facing an inverse problem, so that can not be done in a stable way (without “tricks” like regularisation).

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [June 23, 2024, 11:58am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/3 "2024-06-23T11:58:22Z")

</div>

> [@kellertuer](#):
>
> The inverse operation is not uniquely determined, you are facing an inverse problem, so that can not be done in a stable way (without “tricks” like regularisation).

[Tikhonov regularization](https://en.wikipedia.org/wiki/Ridge_regression) is pretty common for this kind of problem, a version of which (if you have some estimate of the spectral density) is called [Wiener deconvolution](https://en.wikipedia.org/wiki/Wiener_deconvolution). (These can be implemented with FFTs.) This works pretty well in my experience if the noise is relatively small and the PSF is not too blurry.

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [June 23, 2024, 12:08pm UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/4 "2024-06-23T12:08:06Z")

</div>

Tikhonov sometimes gets a bit blurry, but you can also do TV-regularization ([Total variation denoising - Wikipedia](https://en.wikipedia.org/wiki/Total_variation_denoising)) as a regulariser. This usually keeps edges – and is more often used in (pure) denoising and not necessarily deconvolution.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [June 23, 2024, 4:00pm UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/5 "2024-06-23T16:00:27Z")

</div>

Have you looked at the Julia package: [DeconvOptim.jl](https://github.com/roflmaostc/DeconvOptim.jl)?

---

<div class="post-metadata">

### Author: ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)
#### Post date: [June 24, 2024, 5:01am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/6 "2024-06-24T05:01:57Z")

</div>

Thank you, this works well 😀

---

<div class="post-metadata">

### Author: ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)
#### Post date: [June 24, 2024, 10:05am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/7 "2024-06-24T10:05:51Z")

</div>

Author here, if you need some assistance, feel free to ping me 🙂

---

<div class="post-metadata">

### Author: ![Cyan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@Cyan](https://discourse.julialang.org/u/Cyan)
#### Post date: [June 24, 2024, 10:15am UTC](https://discourse.julialang.org/t/a-question-about-psf-deconvolution/116108/8 "2024-06-24T10:15:17Z")

</div>

Thank you. The tutorial is clear on website and youtube 😀
