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

Discourage convert(Array{C}, img) in favor of broadcasting #153

Merged
merged 1 commit into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/contours/contour_detection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ end
function find_contours(image)
nbd = 1
lnbd = 1
image = convert(Array{Float64}, image)
image = Float64.(image)
contour_list = Vector{typeof(CartesianIndex[])}()
done = [false, false, false, false, false, false, false, false]

Expand Down
7 changes: 3 additions & 4 deletions docs/src/tutorials/arrays_colors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ julia> a = [1,2,3,4]
4
```

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

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

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

```julia
julia> c24 = convert(RGB24, c); dump(c24)
julia> c24 = RGB24(c); dump(c24)
ColorTypes.RGB24
color: UInt32 12711591

Expand Down