Skip to content

Commit 3a4e439

Browse files
authored
Discourage convert(Array{C}, img) in favor of broadcasting (#153)
Consistent with JuliaImages/ImageCore.jl#131
1 parent 4c5f204 commit 3a4e439

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

docs/examples/contours/contour_detection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ end
9797
function find_contours(image)
9898
nbd = 1
9999
lnbd = 1
100-
image = convert(Array{Float64}, image)
100+
image = Float64.(image)
101101
contour_list = Vector{typeof(CartesianIndex[])}()
102102
done = [false, false, false, false, false, false, false, false]
103103

docs/src/tutorials/arrays_colors.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ julia> a = [1,2,3,4]
3737
4
3838
```
3939

40-
then all of the following create a new array where the element type is `Float64`:
40+
then either of the following creates a new array where the element type is `Float64`:
4141

4242
```julia
43-
convert(Array{Float64}, a)
4443
map(Float64, a)
4544
Float64.(a) # short for broadcast(Float64, a)
4645
```
@@ -184,7 +183,7 @@ tools. For example, certain C libraries permit or prefer the order of
184183
the color channels to be different:
185184

186185
```julia
187-
julia> dump(convert(BGR, c))
186+
julia> dump(BGR(c))
188187
ColorTypes.BGR{Float32}
189188
b: Float32 0.65485954
190189
g: Float32 0.9650581
@@ -195,7 +194,7 @@ or even to pack the red, green, and blue colors---together with a
195194
dummy "alpha" (transparency) channel---into a single 32-bit integer:
196195

197196
```julia
198-
julia> c24 = convert(RGB24, c); dump(c24)
197+
julia> c24 = RGB24(c); dump(c24)
199198
ColorTypes.RGB24
200199
color: UInt32 12711591
201200

0 commit comments

Comments
 (0)