Skip to content

Commit

Permalink
Corrected the documentation
Browse files Browse the repository at this point in the history
Former-commit-id: a575ed5
Former-commit-id: d28f53a5d1d752aaa18dca68b1a969e6d885e3f4
  • Loading branch information
vishwas1984 committed Oct 26, 2021
1 parent dc70344 commit b9f13a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Notebooks/obsolete/03_Movo2.ipynb.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52381e42272a2052ea61b485747cbbea31d05e23
18ffe2160bf6f9ebfd75c04752d118b743ba2694
30 changes: 18 additions & 12 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ This package is unregistered, so please install using
Pkg> add https://github.com/vishwas1984/LaplaceInterpolation.jl
```

## Dependencies
Install the following dependencies
```
Pkg> add TestImages
Pkg> add Images
Pkg> add Plots
```
## Getting started

Suppose we need to interpolate the following image

```
using LaplaceInterpolation, TestImgaes
using LaplaceInterpolation, TestImages, Images, Random, Plots
img = Float64.(Gray.(testimage("mandrill")))
```
Expand All @@ -26,7 +33,7 @@ For illustration purposes, we'll punch a few holes and randomize some data
rows, columns = (256, 512)
N = rows*columns
mat = convert(Array{Float64}, imgg)[1:rows,1:columns]
mat_original = convert(Array{Float64}, img)[1:rows,1:columns]
N2 = Int64(round(N/2))
No_of_nodes_discarded = Int64(round(0.9*N2))
Expand All @@ -38,32 +45,31 @@ rad = 30*ones(Int64, 2)
discard2 = punch_holes_2D(cent, rad, rows, columns);
discard = vcat(discard1, discard2)
mat[discard] .= 1
mat_discard = copy(mat_original)
mat_discard[discard] .= 1
heatmap(mat, title = "Image with Missing data", yflip = true,
heatmap(mat_discard, title = "Image with Missing data", yflip = true,
c = :bone, clims = (0.0, 1.0))
```

Interpolating using the laplace and matern approximations, we get

```
restored_img_laplace = matern_2d_grid(mat, discard, 1, 0.0)
restored_img_matern = matern_2d_grid(mat, discard, 2, 0.0)
restored_img_laplace = matern_2d_grid(mat_discard, discard, 1, 0.0)
restored_img_matern = matern_2d_grid(mat_discard, discard, 2, 0.0)
```

And plotting, we have

```
p1 = heatmap(mat, title = "Original Data", yflip = true,
p1 = heatmap(mat_original, title = "Original Data", yflip = true,
c = :bone, clims = (0.0, 1.0))
p2 = heatmap(holeyimage1, title = "Image with Missing data", yflip = true,
p2 = heatmap(mat_discard, title = "Image with Missing data", yflip = true,
c = :bone, clims = (0.0, 1.0))
p3 = heatmap(restored_img_laplace, title = "Laplace Interpolated Image", yflip =
true,
c = :bone, clims = (0.0, 1.0))
true, c = :bone, clims = (0.0, 1.0))
p4 = heatmap(restored_img_matern, title = "Matern, m = 2, eps = 0.0", yflip =
true,
c = :bone, clims = (0.0, 1.0))
true, c = :bone, clims = (0.0, 1.0))
plot(p1, p2, p3, p4, layout = (2, 2), legend = false, size = (900, 500))
```
Expand Down

0 comments on commit b9f13a5

Please sign in to comment.