Skip to content

no method matching iterate(::RGB{Float64}) in seeded_region_growing #987

@jrtwolski

Description

@jrtwolski

Hello,
I have difficulty running seeded_region_growing for an RGB/jpeg image:
img2 = load("data/test/car10.jpg")
seeds = [(CartesianIndex(550,450),1), (CartesianIndex(750,250),2), (CartesianIndex(350,450),3)]
segments = seeded_region_growing(img2,seeds)

ends with:
ERROR: LoadError: MethodError: no method matching iterate(::RGB{Float64})
Closest candidates are:
iterate(::Union{LinRange, StepRangeLen}) at range.jl:664
iterate(::Union{LinRange, StepRangeLen}, ::Int64) at range.jl:664
iterate(::T) where T<:Union{Base.KeySet{var"#s77", var"#s76"} where {var"#s77", var"#s76"<:Dict}, Base.ValueIterator{var"#s75"} where var"#s75"<:Dict} at dict.jl:693
...
Stacktrace:
[1] _foldl_impl(op::Base.MappingRF{typeof(abs2), Base.BottomRF{typeof(Base.add_sum)}}, init::Base._InitialValue, itr::RGB{Float64})
@ Base .\reduce.jl:56
[2] foldl_impl(op::Base.MappingRF{typeof(abs2), Base.BottomRF{typeof(Base.add_sum)}}, nt::Base._InitialValue, itr::RGB{Float64})
@ Base .\reduce.jl:48
[3] mapfoldl_impl(f::typeof(abs2), op::typeof(Base.add_sum), nt::Base._InitialValue, itr::RGB{Float64})
@ Base .\reduce.jl:44
[4] mapfoldl(f::Function, op::Function, itr::RGB{Float64}; init::Base._InitialValue)
@ Base .\reduce.jl:160
[5] mapfoldl(f::Function, op::Function, itr::RGB{Float64})
@ Base .\reduce.jl:160
[6] mapreduce(f::Function, op::Function, itr::RGB{Float64}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base .\reduce.jl:287
[7] mapreduce(f::Function, op::Function, itr::RGB{Float64})
@ Base .\reduce.jl:287
[8] sum(f::Function, a::RGB{Float64}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base .\reduce.jl:501
[9] sum(f::Function, a::RGB{Float64})
@ Base .\reduce.jl:501
[10] default_diff_fn(c1::RGB{Float64}, c2::RGB{N0f8})
@ ImageSegmentation C:\Users\PC.julia\packages\ImageSegmentation\MX8ga\src\region_growing.jl:2
[11] seeded_region_growing(img::Matrix{RGB{N0f8}}, seeds::Vector{Tuple{CartesianIndex{2}, Int64}}, neighbourhood::ImageSegmentation.var"#20#24"{CartesianIndex{2}}, diff_fn::typeof(ImageSegmentation.default_diff_fn))
@ ImageSegmentation C:\Users\PC.julia\packages\ImageSegmentation\MX8ga\src\region_growing.jl:125
[12] seeded_region_growing(img::Matrix{RGB{N0f8}}, seeds::Vector{Tuple{CartesianIndex{2}, Int64}}, kernel_dim::Tuple{Int64, Int64}, diff_fn::Function)
@ ImageSegmentation C:\Users\PC.julia\packages\ImageSegmentation\MX8ga\src\region_growing.jl:64
[13] seeded_region_growing (repeats 2 times)
@ C:\Users\PC.julia\packages\ImageSegmentation\MX8ga\src\region_growing.jl:57 [inlined]

Any ideas what is wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions