Skip to content

Commit 3438e4d

Browse files
authored
Fix some depwarns (#80)
Mostly due to colorspace conversion
1 parent c5322b1 commit 3438e4d

File tree

8 files changed

+30
-28
lines changed

8 files changed

+30
-28
lines changed

src/ImageFeatures.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export
6969
#Circles
7070
hough_circle_gradient
7171

72+
_oneunit(i::CartesianIndex) = VERSION >= v"1.1" ? oneunit(i) : one(i)
73+
7274
"""
7375
desc, keypoints = create_descriptor(img, keypoints, params)
7476
desc, keypoints = create_descriptor(img, params)

src/corner.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function corner_orientations(img::AbstractArray{T, 2}, corners::Keypoints, kerne
3838
orientations
3939
end
4040

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

4343
function corner_orientations(img::AbstractArray, kernel::Array{K, 2}) where K<:Real
4444
corners = imcorner(img)

src/houghtransform.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ julia> hough_transform_standard(img)
4242
1-element Array{Tuple{Float64,Float64},1}:
4343
(3.0, 1.5707963267948966)
4444
```
45-
"""
45+
"""
4646
function hough_transform_standard(
4747
img_edges::AbstractMatrix{Bool};
4848
stepsize=1,
@@ -115,17 +115,17 @@ end
115115
```
116116
circle_centers, circle_radius = hough_circle_gradient(img_edges, img_phase, radii; scale=1, min_dist=minimum(radii), vote_threshold)
117117
```
118-
Returns two vectors, corresponding to circle centers and radius.
119-
120-
The circles are generated using a hough transform variant in which a non-zero point only votes for circle
118+
Returns two vectors, corresponding to circle centers and radius.
119+
120+
The circles are generated using a hough transform variant in which a non-zero point only votes for circle
121121
centers perpendicular to the local gradient. In case of concentric circles, only the largest circle is detected.
122-
123-
Parameters:
124-
- `img_edges` = edges of the image
125-
- `img_phase` = phase of the gradient image
122+
123+
Parameters:
124+
- `img_edges` = edges of the image
125+
- `img_phase` = phase of the gradient image
126126
- `radii` = circle radius range
127-
- `scale` = relative accumulator resolution factor
128-
- `min_dist` = minimum distance between detected circle centers
127+
- `scale` = relative accumulator resolution factor
128+
- `min_dist` = minimum distance between detected circle centers
129129
- `vote_threshold` = accumulator threshold for circle detection
130130
131131
[`canny`](@ref) and [`phase`](@ref) can be used for obtaining img_edges and img_phase respectively.
@@ -151,7 +151,7 @@ julia> img_demo = Float64.(img_edges); for c in centers img_demo[c] = 2; end
151151
152152
julia> imshow(img_demo)
153153
```
154-
"""
154+
"""
155155
function hough_circle_gradient(
156156
img_edges::AbstractArray{Bool,2},
157157
img_phase::AbstractArray{<:Number,2},
@@ -218,7 +218,7 @@ function hough_circle_gradient(
218218
radius_accumulator=Vector{Int}(undef, Int(floor(dist(f,l)/scale)+1))
219219

220220
for center in centers
221-
center=(center-1*one(center))*scale
221+
center=(center-1*_oneunit(center))*scale
222222
fill!(radius_accumulator, 0)
223223

224224
too_close=false

test/brief.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ end
153153

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

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

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

175175
keypoints_1 = Keypoints(fastcorners(img_array_1, 12, 0.4))

test/brisk.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010

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

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

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

@@ -44,7 +44,7 @@ end
4444

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

@@ -61,7 +61,7 @@ end
6161

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

test/freak.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ end
1010

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

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

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

@@ -43,7 +43,7 @@ end
4343

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

@@ -60,7 +60,7 @@ end
6060

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

test/glcm.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Test, ImageFeatures, Images
55
0 0 1 1
66
0 2 2 2
77
2 2 3 3 ]
8-
img_gray = convert(Array{Gray}, img / 3)
8+
img_gray = Gray.(img / 3)
99

1010
glcm_mat = glcm(img, 1, 0, 4)
1111
expected_1 = [ 2 2 1 0

test/orb.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313

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

1919
#Test Number of Keypoints returned
@@ -38,7 +38,7 @@ end
3838

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

@@ -53,7 +53,7 @@ end
5353

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

@@ -68,7 +68,7 @@ end
6868

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

0 commit comments

Comments
 (0)