diff --git a/contents/convolutions/1d/1d.md b/contents/convolutions/1d/1d.md index 3e663938e..307e1d669 100644 --- a/contents/convolutions/1d/1d.md +++ b/contents/convolutions/1d/1d.md @@ -53,7 +53,7 @@ With this in mind, we can almost directly transcribe the discrete equation into {% method %} {% sample lang="jl" %} -[import:27-46, lang:"julia"](../code/julia/1d_convolution.jl) +[import:27-46, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} The easiest way to reason about this code is to read it as you might read a textbook. @@ -184,7 +184,7 @@ Here it is again for clarity: {% method %} {% sample lang="jl" %} -[import:27-46, lang:"julia"](../code/julia/1d_convolution.jl) +[import:27-46, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} Here, the main difference between the bounded and unbounded versions is that the output array size is smaller in the bounded case. @@ -192,14 +192,14 @@ For an unbounded convolution, the function would be called with a the output arr {% method %} {% sample lang="jl" %} -[import:58-59, lang:"julia"](../code/julia/1d_convolution.jl) +[import:58-59, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} On the other hand, the bounded call would set the output array size to simply be the length of the signal {% method %} {% sample lang="jl" %} -[import:61-62, lang:"julia"](../code/julia/1d_convolution.jl) +[import:61-62, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} Finally, as we mentioned before, it is possible to center bounded convolutions by changing the location where we calculate the each point along the filter. @@ -207,7 +207,7 @@ This can be done by modifying the following line: {% method %} {% sample lang="jl" %} -[import:35-35, lang:"julia"](../code/julia/1d_convolution.jl) +[import:35-35, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} Here, `j` counts from `i-length(filter)` to `i`. @@ -239,7 +239,7 @@ In code, this typically amounts to using some form of modulus operation, as show {% method %} {% sample lang="jl" %} -[import:4-25, lang:"julia"](../code/julia/1d_convolution.jl) +[import:4-25, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} This is essentially the same as before, except for the modulus operations, which allow us to work on a periodic domain. @@ -254,7 +254,7 @@ For the code associated with this chapter, we have used the convolution to gener {% method %} {% sample lang="jl" %} -[import, lang:"julia"](../code/julia/1d_convolution.jl) +[import, lang:"julia"](code/julia/1d_convolution.jl) {% endmethod %} At a test case, we have chosen to use two sawtooth functions, which should produce the following images: diff --git a/contents/convolutions/code/julia/1d_convolution.jl b/contents/convolutions/1d/code/julia/1d_convolution.jl similarity index 100% rename from contents/convolutions/code/julia/1d_convolution.jl rename to contents/convolutions/1d/code/julia/1d_convolution.jl diff --git a/contents/convolutions/2d/2d.md b/contents/convolutions/2d/2d.md index 7fc21aeb6..dc52157fe 100644 --- a/contents/convolutions/2d/2d.md +++ b/contents/convolutions/2d/2d.md @@ -20,9 +20,9 @@ In code, a two-dimensional convolution might look like this: {% method %} {% sample lang="jl" %} -[import:4-28, lang:"julia"](../code/julia/2d_convolution.jl) +[import:4-28, lang:"julia"](code/julia/2d_convolution.jl) {% sample lang="py" %} -[import:5-19, lang:"python"](../code/python/2d_convolution.py) +[import:5-19, lang:"python"](code/python/2d_convolution.py) {% endmethod %} This is very similar to what we have shown in previous sections; however, it essentially requires four iterable dimensions because we need to iterate through each axis of the output domain *and* the filter. @@ -49,9 +49,9 @@ At this stage, it is important to write some code, so we will generate a simple {% method %} {% sample lang="jl" %} -[import:30-47, lang:"julia"](../code/julia/2d_convolution.jl) +[import:30-47, lang:"julia"](code/julia/2d_convolution.jl) {% sample lang="py" %} -[import:21-33, lang:"python"](../code/python/2d_convolution.py) +[import:21-33, lang:"python"](code/python/2d_convolution.py) {% endmethod %} Though it is entirely possible to create a Gaussian kernel whose standard deviation is independent on the kernel size, we have decided to enforce a relation between the two in this chapter. @@ -138,9 +138,9 @@ In code, the Sobel operator involves first finding the operators in $$x$$ and $$ {% method %} {% sample lang="jl" %} -[import:49-63, lang:"julia"](../code/julia/2d_convolution.jl) +[import:49-63, lang:"julia"](code/julia/2d_convolution.jl) {% sample lang="py" %} -[import:36-52, lang:"python"](../code/python/2d_convolution.py) +[import:36-52, lang:"python"](code/python/2d_convolution.py) {% endmethod %} With that, I believe we are at a good place to stop discussions on two-dimensional convolutions. @@ -153,9 +153,9 @@ We have also added code to create the Gaussian kernel and Sobel operator and app {% method %} {% sample lang="jl" %} -[import, lang:"julia"](../code/julia/2d_convolution.jl) +[import, lang:"julia"](code/julia/2d_convolution.jl) {% sample lang="py" %} -[import, lang:"python"](../code/python/2d_convolution.py) +[import, lang:"python"](code/python/2d_convolution.py) {% endmethod %}