JuliaImages / JuliaImages/ImageFeatures.jl
hough_circle_gradient: centers could hold 0 in CartesianIndex
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 49
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
centers calculation could result in 0 in CartesianIndex. which is invalid value for array referencing in Julia
julia> centers, radii = hough_circle_gradient(img_edges, img_phase, 20:30, vote_threshold=2);
julia> img_demo = Float64.(img_edges); for c in centers img_demo[c] = 2; end
ERROR: BoundsError: attempt to access 312×252 Array{Float64,2} at index [152, 0]
Stacktrace:
[1] setindex! at ./array.jl:769 [inlined]
[2] setindex!(::Array{Float64,2}, ::Int64, ::CartesianIndex{2}) at ./multidimensional.jl:460
[3] top-level scope at ./REPL[40]:1 [inlined]
[4] top-level scope at ./none:0
julia> centers
96-element Array{CartesianIndex{2},1}:
CartesianIndex(152, 0)
⋮
CartesianIndex(0, 40)
Probably this happens during executing this statement: center=(center-1*one(center))*scale
julia> c = CartesianIndex(1, 2)
CartesianIndex(1, 2)
julia> c = (c - 1*one(c))
CartesianIndex(0, 1)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the hough_circle_gradient entry point and inspect the centers calculation, especially center=(center-1*one(center))*scale. Reproduce the issue with the supplied Julia example and verify that the returned centers can be used for array indexing without producing zero coordinates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100