Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions doc/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ plot!(t, polished, label="Recovered with Wiener") # ...original and recovered si
plot!(t, signal, label="Lomb–Scargle model") #...and best fitting Lomb–Scargle model
```

![image](wiener-time-series-observed.png)
![image](wiener/time-series-observed.png)

![image](wiener-time-series-recovered.png)
![image](wiener/time-series-recovered.png)

Note that the signal recovered with the Wiener deconvolution is
generally a good improvement with respect to the best-fitting
Expand Down Expand Up @@ -209,7 +209,13 @@ view(polished) # ...the polished image
view(polished2) # ...the second polished image
```

![image](wiener-cameraman.jpg)
| Original image | Blurred image |
| :------------------------------------------------- | :--------------------------------------------------------- |
| ![](wiener/original.jpg) | ![](wiener/blurred.jpg) |

| Image restored with exact power spectrum and noise | Image restored with imperfect reference noise and spectrum |
| :------------------------------------------------- | :--------------------------------------------------------- |
| ![](wiener/polished.jpg) | ![](wiener/polished2.jpg) |

### Richardson-Lucy deconvolution

Expand Down Expand Up @@ -240,7 +246,14 @@ aberration.
imshow(restored_img_2000)
```

![image](lucy-cameraman.jpg)
| Original image | Blurred image |
| :--------------------------------- | :------------------------------- |
| ![](lucy/original.jpg) | ![](lucy/blurred.jpg) |

| Result of 200 `lucy` iterations | Result of 2000 `lucy` iterations |
| :--------------------------------- | :--------------------------------|
| ![](lucy/restored_200.jpg) | ![](lucy/restored_2000.jpg) |


## Development

Expand Down
Binary file removed doc/src/lucy-cameraman.jpg
Binary file not shown.
Binary file added doc/src/lucy/blurred.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions doc/src/lucy-cameraman.jl → doc/src/lucy/cameraman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ blurred_img = fft(img) .* fft(blurring) |> ifft |> real

(N, M) = size(blurred_img)

out = ((vcat(hcat(img, ones(M, 20), blurred_img),
ones(20, 2M+20),
hcat(result_200_iterations, ones(M, 20), result_2000_iterations))))

save("lucy-cameraman.jpg", Images.clamp01nan.(out))
save("original.jpg", Images.clamp01nan.(img))
save("blurred.jpg", Images.clamp01nan.(blurred_img))
save("restored_200.jpg", Images.clamp01nan.(result_200_iterations))
save("restored_2000.jpg", Images.clamp01nan.(result_2000_iterations))
Binary file added doc/src/lucy/original.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/src/lucy/restored_200.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/src/lucy/restored_2000.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/src/wiener-cameraman.jpg
Binary file not shown.
Binary file added doc/src/wiener/blurred.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions doc/src/wiener-cameraman.jl → doc/src/wiener/cameraman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ noise2 = rand(Float64, size(img)) # Create another additive noise
# Polish the image with Deconvolution deconvolution
polished2 = wiener(blurred_img, img2, noise2, blurring)

out = ((vcat(hcat(img, ones(512, 20), blurred_img),
ones(20, 1024+20),
hcat(polished, ones(512, 20), polished2))))
save("wiener-cameraman.jpg", Images.clamp01nan.(out))
save("original.jpg", Images.clamp01nan.(img))
save("blurred.jpg", Images.clamp01nan.(blurred_img))
save("polished.jpg", Images.clamp01nan.(polished))
save("polished2.jpg", Images.clamp01nan.(polished2))
Binary file added doc/src/wiener/original.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/src/wiener/polished.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/src/wiener/polished2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions doc/src/wiener-time-series.jl → doc/src/wiener/time-series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
#
### Code:

using Random

Random.seed!(7)

using LombScargle, Deconvolution, Plots
using LombScargle, Deconvolution, Plots, Statistics
t = range(0, stop=10, length=1000) # observation times
x = sinpi(t) .* cos(5t) - 1.5cospi(t) .* sin(2t) # the original signal
x = sinpi.(t) .* cos.(5t) - 1.5cospi.(t) .* sin.(2t) # the original signal
n = rand(length(x)) # noise to be added
y = x + 3(n - mean(n)) # observed noisy signal
y = x + 3(n .- mean(n)) # observed noisy signal
# Lomb-Scargle periodogram
p = lombscargle(t, y, maximum_frequency=2, samples_per_peak=10)
plot(freqpower(p)...)
Expand All @@ -35,8 +37,8 @@ noise = rand(length(y)) # noise for `wiener`
polished = wiener(y, signal, noise)
plot(t, x, size=(900, 600), label="Original signal", linewidth=2)
plot!(t, y, label="Observed signal")
savefig("wiener-time-series-observed.png")
savefig("time-series-observed.png")
plot(t, x, size=(900, 600), label="Original signal", linewidth=2)
plot!(t, polished, label="Recovered with Wiener")
plot!(t, signal, label="Lomb–Scargle model")
savefig("wiener-time-series-recovered.png")
savefig("time-series-recovered.png")