Image Processing

Hi! I having the problem to view an 3D Image. Consider the image array as:

Image[:, :, 1] = 0.0031054   0.00385944   0.00372917   0.000612832 
               0.0020886   0.000983508  0.000783196  0.000259077
               0.00157612  0.0017428    0.00129955   0.00016654   
               0.00103882  0.000802456  0.00114514   0.000242924
Image[:, :, 2] = 0.0031054   0.00385944   0.00372917   0.000612832 
               0.0020886   0.000983508  0.000783196  0.000259077
               0.00157612  0.0017428    0.00129955   0.00016654   
               0.00103882  0.000802456  0.00114514   0.000242924
Image[:, :, 3] = 0.0031054   0.00385944   0.00372917   0.000612832 
               0.0020886   0.000983508  0.000783196  0.000259077
               0.00157612  0.0017428    0.00129955   0.00016654   
               0.00103882  0.000802456  0.00114514   0.000242924

I need to see this image colored, combine 3 channel in one image. When i use img = RGB.(Image) function to convert and imshow(img) to see, it show the 3 channel separately. Thanks!

JuliaImages uses the array of struct layout Array{RGB} to represent an image, thus you’ll have to construct the RGB object manually first

colorview(RGB, permutedims(Image, (3, 1, 2)))

The permutedims is to convert the memory layout from RRR...GGG...BBB-like struct of array layout to RGB...RGB-like array of struct layout. Then you can use colorview function to interpret it as an ReinterpretedArray{RGB} stuff.

1 Like

Thank you! It worked.