In the following chapters, we will need to convert an array of numbers into colors. This is achieved with the colorview function. Let's look into the following code to generate a random three-dimensional array and turn it into an RGB image:
using Images, ImageViewrandom_img_array = rand(3, 8, 8); # channel, height, widthimg = colorview(RGB, random_img_array);imshow(img)
It is important to note that the channel dimension is first, followed by height, then width. If the channel dimension is not first, but last, for example, we should use the permuteddimsview or permutedims functions to put them in the correct order. This is shown in the following code:
using Images, ImageViewrandom_img_array = rand(40, ...