# MATLAB: How to convert pixel intensities into pixel spectrum

hyperspectral imageshyperspectral videopixel intensitiespixel spectrum

In an experiment, some researchers used a video hyperspectral (HS) camera (a video camera + interferometer + lenses) in order to get hyperspectral images (HSI) in the 650-1100 nm range, with a resolution of 5 nm. They try to classify the elements in the entire HSI. One way of doing this is by means of analysing the spectrum of each component in the sample. Sugar gives a characteristic spectrum, different from the chlorophyll spectrum, and so on.
For an unknown reason, their system does not save the hypercube as say, “sample.hdr” and “sample.raw” files, as common HS systems do. Instead, the video system saves the captured data as a series of “.png” image files, i.e., photos; one for each wavelength.
I think I can read the images and create the R, G, B data matrices:
``clear; clc;files = dir('*.png');dataR = [];dataG = [];dataB = [];for ii = 1:size(files,1)    [a, cmap] = imread(files(ii).name);    dataR(:, :, ii) = a(:, :, 1);    dataG(:, :, ii) = a(:, :, 2);    dataB(:, :, ii) = a(:, :, 3);end``
For instance, the cube dataR is a 1040x1392x91 double matrix with size of 1053911040.
However, the 91 values (dimension p) in each individual picture-cube do not represent any sort of continuous spectra at all (like: The above is an example of a spectrum.
They appear as some kind of squared intensities, like the two right-hand images in: Above is an example of a discontinuous signal or response. I don’t know much about video, so I’m assuming that the png compression process binned the data and left only those rather discontinuous intensities. Am I wrong?
Is there a way to transform each of the 91 elements in the p dimension (each pixel’s individual intensity) into a real pixel’s spectral signature?
In other words, can I convert all the p intensities of a pixel into a spectrum of that pixel?
Thanks a lot for any hint.