Suppose I have an RGB image, imported with
img = FileIO.load("image.png");
Then I have two questions:
First, in Jupyter, using IJulia, how do I view a small subarray (say 3 x 3) as a set of numeric values? If img was a gray-scale image, then I can view a subarray with
Float64.(img[100:102,200:202])
but this doesn’t work for RGB images.
I can see all the values with dump(img[100:102,200:202])
but that is very inconveniently displayed. I’m looking for outputs such as are shown as examples in Quickstart · JuliaImages In a console these would be given as shown, but IJulia interprets any image or subimage as an array of coloured pixels, and displays them as such. I can use channelview
but that gives me three (or four) separate arrays, and I want one array, with each element consisting of the RGB values of the pixels.
Secondly, arithmetic on RGB values. This works:
x = img[100:102,200:202]
x .* 0.5
but these don’t:
round.(x)
x .+ 0.2
There’s clearly something very fundamental I’m misunderstanding about image data structures, but how can you define adding a constant, or rounding, to the RGB values of an image?
Thank you very much,
Alasdair