# NOT RUN {
#Perform a convolution with the default gaussian kernel
plot_image(dragon)
#Perform a convolution with the default gaussian kernel
render_convolution(dragon, preview = TRUE)
#Increase the width of the kernel
# }
# NOT RUN {
render_convolution(dragon, kernel = 2, kernel_dim=21,kernel_extent=6, preview = TRUE)
# }
# NOT RUN {
#Only perform the convolution on bright pixels (bloom)
# }
# NOT RUN {
render_convolution(dragon, kernel = 5, kernel_dim=24, kernel_extent=24,
min_value=1, preview = TRUE)
# }
# NOT RUN {
#Use a built-in kernel:
# }
# NOT RUN {
render_convolution(dragon, kernel = generate_2d_exponential(falloff=2, dim=31, width=21),
preview = TRUE)
# }
# NOT RUN {
#We can also apply this function to matrices:
# }
# NOT RUN {
volcano %>% image()
volcano %>%
render_convolution(kernel=generate_2d_gaussian(sd=1,dim=31)) %>%
image()
# }
# NOT RUN {
#Use a custom kernel (in this case, an X shape):
custom = diag(10) + (diag(10)[,10:1])
# }
# NOT RUN {
plot_image(custom)
render_convolution(dragon, kernel = custom, preview = TRUE)
# }
Run the code above in your browser using DataLab