Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hough_circle_gradient: centers could hold 0 in CartesianIndex #67

Open
AmebaBrain opened this issue Nov 12, 2019 · 0 comments
Open

hough_circle_gradient: centers could hold 0 in CartesianIndex #67

AmebaBrain opened this issue Nov 12, 2019 · 0 comments

Comments

@AmebaBrain
Copy link

AmebaBrain commented Nov 12, 2019

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant