Converting from 24-bit image as byte array to RGB

I am working on Data-exchange Julia-LabView . Now I’m trying to send image data to Julia. I get image now as 3xMxN array of UInt8. How to convert it to RGB? The following works, but it must be possible to avoid convesion to floats.

# r is a 3xMxN array of UInt8
rc = r/255.0 
im2 = colorview(RGB, rc)

How about

im2 = reinterpret(RGB{N0f8}, rc)

Or colorview(RGB, normedview(img)) from ImageCore.

1 Like

Thank you, contradict & tim.holy

im2 = reinterpret(RGB{N0f8}, r)

produce something, but it wouldn’t display as an image.

im2 = colorview(RGB{N0f8}, r)

would work, though producing some complicated type:

Base.ReshapedArray{RGB{Normed{UInt8,8}},2,Base.ReinterpretArray{RGB{Normed{UInt8,8}},3,UInt8,SubArray{UInt8,3,Array{UInt8,3},Tuple{ImageCore.ColorChanPerm{3},Base.Slice{Base.OneTo{Int64}},Base.Slice{Base.OneTo{Int64}}},false}},Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64},Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}

and

colorview(RGB, normedview(r))

appears the best and generic solution.