I want to make Array{UInt8,3} (color image data) from Array{UInt8,2} (grayscale image data) in Julia 0.4 like the following:
using Images
dat = data(img)
dat2 = map(x -> (v = x*2 % UInt8; [v,0,0]), dat)
img2 = colorim(dat2)
However, the code above makes Array{Array{UInt8,1},2} instead. How can I make a "flatten" multidimensional array?
You can also use
z = zeros(UInt8, size(A))
colorim(cat(3, A, z, z))
where A is whatever you want in the red channel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With