-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdeprecated.jl
87 lines (81 loc) · 3.1 KB
/
deprecated.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using ImageCore, Colors, FixedPointNumbers, OffsetArrays
using Test, Random
@testset "convert (deprecations)" begin
@info "Deprecation warnings are expected"
a = [RGB(1,0,0) RGB(0,0,1);
RGB(0,1,0) RGB(1,1,1)]
c = @inferred(convert(Array{BGR}, a))
@test eltype(c) == BGR{N0f8}
c = @inferred(convert(Array{BGR{Float32}}, a))
@test eltype(c) == BGR{Float32}
c = @inferred(convert(Array{Lab}, a))
@test eltype(c) == Lab{Float32}
for a in (rand(Float32, (4,5)),
bitrand(4,5))
b = @inferred(convert(Array{Gray}, a))
@test eltype(b) == Gray{eltype(a)}
b = @inferred(convert(Array{Gray{N0f8}}, a))
@test eltype(b) == Gray{N0f8}
end
# Gray images wrapped by an OffsetArray.
A = rand(8,8)
for img in ( Gray.(A),
Gray.(N0f8.(A)),
Gray.(N0f16.(A)) )
imgo = OffsetArray(img, -2, -1)
s = @inferred(convert(OffsetArray{Gray{Float32},2,Array{Gray{Float32}}},imgo))
@test eltype(s) == Gray{Float32}
@test s isa OffsetArray{Gray{Float32},2,Array{Gray{Float32},2}}
@test permutedims(permutedims(s,(2,1)),(2,1)) == s
@test axes(s) === axes(imgo)
end
for img in ( Gray.(A),
Gray.(N0f8.(A)),
Gray.(N0f16.(A)) )
imgo = OffsetArray(img, -2, -1)
s = @inferred(convert(OffsetArray{Gray{N0f8},2,Array{Gray{N0f8}}},imgo))
@test eltype(s) == Gray{N0f8}
@test s isa OffsetArray{Gray{N0f8},2,Array{Gray{N0f8},2}}
@test permutedims(permutedims(s,(2,1)),(2,1)) == s
@test axes(s) === axes(imgo)
end
for img in ( Gray.(A),
Gray.(N0f8.(A)),
Gray.(N0f16.(A)) )
imgo = OffsetArray(img, -2, -1)
s = @inferred(convert(OffsetArray{Gray{N0f16},2,Array{Gray{N0f16}}},imgo))
@test eltype(s) == Gray{N0f16}
@test s isa OffsetArray{Gray{N0f16},2,Array{Gray{N0f16},2}}
@test permutedims(permutedims(s,(2,1)),(2,1)) == s
@test axes(s) === axes(imgo)
end
# Color images wrapped by an OffsetArray.
A = rand(RGB{Float32},8,8)
for img in ( A,
n0f8.(A),
n6f10.(A),
n4f12.(A),
n2f14.(A),
n0f16.(A))
imgo = OffsetArray(img, -2, -1)
s = @inferred(convert(OffsetArray{RGB{N0f8},2,Array{RGB{N0f8}}},imgo))
@test eltype(s) == RGB{N0f8}
@test s isa OffsetArray{RGB{N0f8},2,Array{RGB{N0f8},2}}
@test permutedims(permutedims(s,(2,1)),(2,1)) == s
@test axes(s) === axes(imgo)
end
A = rand(RGB{Float32},8,8)
for img in ( A,
n0f8.(A),
n6f10.(A),
n4f12.(A),
n2f14.(A),
n0f16.(A))
imgo = OffsetArray(img, -2, -1)
s = @inferred(convert(OffsetArray{RGB{Float32},2,Array{RGB{Float32}}},imgo))
@test eltype(s) == RGB{Float32}
@test s isa OffsetArray{RGB{Float32},2,Array{RGB{Float32},2}}
@test permutedims(permutedims(s,(2,1)),(2,1)) == s
@test axes(s) === axes(imgo)
end
end