Skip to content

Instantly share code, notes, and snippets.

@ashwani-rathee
Last active December 8, 2022 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashwani-rathee/b64aed455f0fb73b671b97f2b0954c5e to your computer and use it in GitHub Desktop.
Save ashwani-rathee/b64aed455f0fb73b671b97f2b0954c5e to your computer and use it in GitHub Desktop.
Float Matrix to RGB
Executing task: julia --color=yes --threads=auto --project=/home/ashwani/.julia/environments/v1.7 /home/ashwani/learnhpc/test.jl
result = RGB{Float64}[RGB{Float64}(0.5,0.5,0.5) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.5,0.5,0.5) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(1.0,1.0,1.0) RGB{Float64}(0.5,0.5,0.5) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0); RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.0,0.0,0.0) RGB{Float64}(0.5,0.5,0.5)]
eltype(result) = RGB{Float64}
size(result) = (10, 12)
using Images
img = [
0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.5 1.0 1.0 1.0 1.0 1.0 1.0 0.5 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5
]
result = RGB.(img)
@show result
@show eltype(result)
@show size(result)
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment