Hi,
I have a question about how to use the imfilter!
function from ImageFiltering so that is computes only on provided inds. I am having trouble making a simple example work. Here is my code:
using ImageFiltering, Images, ComputationalResources
# Create a sample image:
tile_size = 50
board_size = 4 # must be even
mini_board = [zeros(tile_size, tile_size) ones(tile_size, tile_size);
ones(tile_size, tile_size) zeros(tile_size, tile_size)]
chessboard = repeat(mini_board, outer=(convert(Integer,(board_size/2)), convert(Integer,(board_size/2))))
img = chessboard
# Create a filter:
sigma = 3
filter_size = 21
gaus = ImageFiltering.KernelFactors.gaussian(sigma, filter_size)
kernel = kernelfactors((gaus, gaus))
# params of imfilter function
imgfilt = similar(img)
inds = CartesianIndex(50, 50) # simple inds
# The filtering that errors:
imfilter!(CPU1(Algorithm.FIRTiled()), imgfilt, img, kernel, "symmetric", inds)
From the documentation I thought this would work, but it doesn’t. I get an error like this:
ERROR: MethodError: no method matching factorkernel(::Tuple{ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,0,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1
}}},ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}}})
Closest candidates are:
factorkernel(::AbstractArray{T,2}) where T at /Users/MrTrololord/.julia/packages/ImageFiltering/jhBno/src/imfilter.jl:1493
factorkernel(::AbstractArray) at /Users/MrTrololord/.julia/packages/ImageFiltering/jhBno/src/imfilter.jl:1489
factorkernel(::ImageFiltering.Kernel.Laplacian) at /Users/MrTrololord/.julia/packages/ImageFiltering/jhBno/src/imfilter.jl:1490
Stacktrace:
[1] imfilter!(::CPU1{ImageFiltering.Algorithm.FIRTiled{0}}, ::Array{Float64,2}, ::Array{Float64,2}, ::Tuple{ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,0,O
ffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}},ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}}}, :
:String, ::CartesianIndex{2}) at /Users/MrTrololord/.julia/packages/ImageFiltering/jhBno/src/imfilter.jl:585
[2] top-level scope at /Users/MrTrololord/Google_Drive/cvut/bakalarka/LAP_julia/test/try4.jl:182
Can anyone help me make this work?
EDIT:
I think there might be something wrong with ImageFiltering dispatch? I’m going to post an issue at ImageFiltering.jl.