0
votes

I am trying to read an input image using octave and plot its RGB values as a 3 dimension plot.

I am reading image using

im = imread('image')

How can I plot this?

Also, is it possible to plot a histogram of all the 3 layers?

Thanks

1
The Octave API doc says your im variable will be an MxNx3 matrix when you load a color image, so you should already have your "image data" as RGB channels. What do you want to plot, exactly? - Sven
Hi Sven, I would either like to plot my RGB channels as a 3D plot. 1 channel per dimension. Or separate histograms per channel. - dopplesoldner

1 Answers

2
votes

As already stated, the Octave API doc gives you an MxNx3 matrix data set of your image.

The R/G/B channels are the last dimensions of your im matrix. hist needs 1d input, so we'll need to reshape it:

hist(reshape(im(:,:,1),1,[])) # red
hist(reshape(im(:,:,2),1,[])) # green
hist(reshape(im(:,:,3),1,[])) # blue

About the 3D plot: do you mean a 3D scatter plot? Then Octave's scatter3 might help you.