How to use dilate in Julia

Sorry, I assumed it allowed rectangular windows, but all you can do is include/exclude dimensions from dilation:

help?> dilate
search: dilate dilate! assert_timedim_last AdaptiveEqualization

  imgd = dilate(img, [region])

  perform a max-filter over nearest-neighbors. The default is 8-connectivity
  in 2d, 27-connectivity in 3d, etc. You can specify the list of dimensions
  that you want to include in the connectivity, e.g., region = [1,2] would
  exclude the third dimension from filtering.

You could instead use mapwindow as follows:

julia> mapwindow(maximum, bright_pixel, (3, 5))
5×5 Array{Gray{N0f8},2} with eltype Gray{Normed{UInt8,8}}:
 Gray{N0f8}(0.0)  Gray{N0f8}(0.0)  …  Gray{N0f8}(0.0)  Gray{N0f8}(0.0)
 Gray{N0f8}(1.0)  Gray{N0f8}(1.0)     Gray{N0f8}(1.0)  Gray{N0f8}(1.0)
 Gray{N0f8}(1.0)  Gray{N0f8}(1.0)     Gray{N0f8}(1.0)  Gray{N0f8}(1.0)
 Gray{N0f8}(1.0)  Gray{N0f8}(1.0)     Gray{N0f8}(1.0)  Gray{N0f8}(1.0)
 Gray{N0f8}(0.0)  Gray{N0f8}(0.0)     Gray{N0f8}(0.0)  Gray{N0f8}(0.0)

julia> Int.(ans)
5×5 Array{Int64,2}:
 0  0  0  0  0
 1  1  1  1  1
 1  1  1  1  1
 1  1  1  1  1
 0  0  0  0  0
1 Like