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:



colorview(RGB, normedview(r))

appears the best and generic solution.