Skip to content

Commit

Permalink
Fix some depwarns (#80)
Browse files Browse the repository at this point in the history
Mostly due to colorspace conversion
  • Loading branch information
timholy authored Aug 27, 2020
1 parent c5322b1 commit 3438e4d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 2 additions & 0 deletions src/ImageFeatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export
#Circles
hough_circle_gradient

_oneunit(i::CartesianIndex) = VERSION >= v"1.1" ? oneunit(i) : one(i)

"""
desc, keypoints = create_descriptor(img, keypoints, params)
desc, keypoints = create_descriptor(img, params)
Expand Down
2 changes: 1 addition & 1 deletion src/corner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function corner_orientations(img::AbstractArray{T, 2}, corners::Keypoints, kerne
orientations
end

corner_orientations(img::AbstractArray{T, 2}, corners::Keypoints, kernel::Array{K, 2}) where {T, K<:Real} = corner_orientations(convert(Array{Gray}, img), corners, kernel)
corner_orientations(img::AbstractArray{T, 2}, corners::Keypoints, kernel::Array{K, 2}) where {T, K<:Real} = corner_orientations(Gray.(img), corners, kernel)

function corner_orientations(img::AbstractArray, kernel::Array{K, 2}) where K<:Real
corners = imcorner(img)
Expand Down
24 changes: 12 additions & 12 deletions src/houghtransform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ julia> hough_transform_standard(img)
1-element Array{Tuple{Float64,Float64},1}:
(3.0, 1.5707963267948966)
```
"""
"""
function hough_transform_standard(
img_edges::AbstractMatrix{Bool};
stepsize=1,
Expand Down Expand Up @@ -115,17 +115,17 @@ end
```
circle_centers, circle_radius = hough_circle_gradient(img_edges, img_phase, radii; scale=1, min_dist=minimum(radii), vote_threshold)
```
Returns two vectors, corresponding to circle centers and radius.
The circles are generated using a hough transform variant in which a non-zero point only votes for circle
Returns two vectors, corresponding to circle centers and radius.
The circles are generated using a hough transform variant in which a non-zero point only votes for circle
centers perpendicular to the local gradient. In case of concentric circles, only the largest circle is detected.
Parameters:
- `img_edges` = edges of the image
- `img_phase` = phase of the gradient image
Parameters:
- `img_edges` = edges of the image
- `img_phase` = phase of the gradient image
- `radii` = circle radius range
- `scale` = relative accumulator resolution factor
- `min_dist` = minimum distance between detected circle centers
- `scale` = relative accumulator resolution factor
- `min_dist` = minimum distance between detected circle centers
- `vote_threshold` = accumulator threshold for circle detection
[`canny`](@ref) and [`phase`](@ref) can be used for obtaining img_edges and img_phase respectively.
Expand All @@ -151,7 +151,7 @@ julia> img_demo = Float64.(img_edges); for c in centers img_demo[c] = 2; end
julia> imshow(img_demo)
```
"""
"""
function hough_circle_gradient(
img_edges::AbstractArray{Bool,2},
img_phase::AbstractArray{<:Number,2},
Expand Down Expand Up @@ -218,7 +218,7 @@ function hough_circle_gradient(
radius_accumulator=Vector{Int}(undef, Int(floor(dist(f,l)/scale)+1))

for center in centers
center=(center-1*one(center))*scale
center=(center-1*_oneunit(center))*scale
fill!(radius_accumulator, 0)

too_close=false
Expand Down
4 changes: 2 additions & 2 deletions test/brief.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Translation (100, 200))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_array_2 = _warp(img_array_1, 100, 200)

keypoints_1 = Keypoints(fastcorners(img_array_1, 12, 0.4))
Expand All @@ -169,7 +169,7 @@ end

@testset "Testing with Standard Images - Lena (Translation (10, 20))" begin
img = testimage("lena_gray_512")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_array_2 = _warp(img_array_1, 10, 20)

keypoints_1 = Keypoints(fastcorners(img_array_1, 12, 0.4))
Expand Down
8 changes: 4 additions & 4 deletions test/brisk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45)" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_array_2 = _warp(img_array_1, pi / 4)

features_1 = Features(fastcorners(img_array_1, 12, 0.35))
Expand All @@ -27,7 +27,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -44,7 +44,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 75, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, 5 * pi / 6)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -61,7 +61,7 @@ end

@testset "Testing with Standard Images - Lena (Rotation 45, Translation (10, 20))" begin
img = testimage("lena_gray_512")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 10, 20)

Expand Down
8 changes: 4 additions & 4 deletions test/freak.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45)" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_array_2 = _warp(img_array_1, pi / 4)

keypoints_1 = Keypoints(fastcorners(img_array_1, 12, 0.35))
Expand All @@ -26,7 +26,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -43,7 +43,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 75, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, 5 * pi / 6)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -60,7 +60,7 @@ end

@testset "Testing with Standard Images - Lena (Rotation 45, Translation (10, 20))" begin
img = testimage("lena_gray_512")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 10, 20)

Expand Down
2 changes: 1 addition & 1 deletion test/glcm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Test, ImageFeatures, Images
0 0 1 1
0 2 2 2
2 2 3 3 ]
img_gray = convert(Array{Gray}, img / 3)
img_gray = Gray.(img / 3)

glcm_mat = glcm(img, 1, 0, 4)
expected_1 = [ 2 2 1 0
Expand Down
8 changes: 4 additions & 4 deletions test/orb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45)" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_array_2 = _warp(img_array_1, pi / 4)

#Test Number of Keypoints returned
Expand All @@ -38,7 +38,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 45, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -53,7 +53,7 @@ end

@testset "Testing with Standard Images - Lighthouse (Rotation 75, Translation (50, 40))" begin
img = testimage("lighthouse")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, 5 * pi / 6)
img_array_2 = _warp(img_temp_2, 50, 40)

Expand All @@ -68,7 +68,7 @@ end

@testset "Testing with Standard Images - Lena (Rotation 45, Translation (10, 20))" begin
img = testimage("lena_gray_512")
img_array_1 = convert(Array{Gray}, img)
img_array_1 = Gray.(img)
img_temp_2 = _warp(img_array_1, pi / 4)
img_array_2 = _warp(img_temp_2, 10, 20)

Expand Down

0 comments on commit 3438e4d

Please sign in to comment.