Using ImageSmooth
Installation
You can install ImageSmooth.jl via package manager.
(@v1.6) pkg> add ImageSmoothUsing an image-smoothing algorithm
Each smoothing algorithm in ImageSmooth.jl is an AbstractImageSmoothAlgorithm.
Currently, there is one image-smoothing algorithm can be used:
You can define an image-smoothing algorithm fₛ as follow.
julia> using ImageSmoothjulia> fₛ = L0Smooth()L0Smooth(0.02, 2.0, 100000.0)
Applying the algorithm to the image
All of the algorithms are applied to the image via smooth or the in-place operation smooth!.
julia> imgₛ = smooth(img, fₛ);
julia> imgₛ = similar(img);ERROR: UndefVarError: img not definedjulia> smooth!(imgₛ, img, fₛ);ERROR: UndefVarError: smooth! not defined
Demonstration
To use the smoothing operator, you have to first define a fₛ::AbstractImageSmoothAlgorithm, like L0Smooth. Then you can apply fₛ by using smooth or smooth!.
- You can use
smoothto process your image:
using ImageSmooth
img = testimage("cameraman")
# Define the smoothing algorithm needed to use
fₛ = L0Smooth() # using default arguements
# Apply the algorithm to the image
imgₛ = smooth(img, fₛ)
# View the original image and the smoothed image
mosaicview(img, imgₛ; nrow=1)- You can also use the in-place operator
smooth!:
using ImageSmooth
img = testimage("cameraman")
fₛ = L0Smooth()
imgₛ = similar(img)
smooth!(imgₛ, img, fₛ)
# View the original image and the smoothed image
mosaicview(img, imgₛ; nrow=1)