# How to simulate hyper-spectral images

Hyper-spectral images are images with many bands $(\ge 100)$ while the normal color images have only three bands $\rm (r,g,b)$. It is not difficult to simulate an artificial gray-scale image with the following Matlab codes:

width = 200;
height = 200;
img = ones(height,width)*10;
img(floor(height/4):floor(height*3/4),floor(width/4):floor(width*3/4))= 200;
noise = 5+10*randn(height,width);
img = img+noise;
img(img<0)=0;
img(img>255)=255;
figure; imshow(img,[]);


The following simulation image can be obtained:

In the simulation image, the object is a square in the center and the rest is the background. The object is of gray-value 200, and both object and background are contaminated by Gaussian noise. It is also possible to perform blurring before adding noise. The blurring is used to simulate the system point spread function.

Then comes to my question: how can we simulate a hyper-spectral image?

For the time being, my solution is as follows:

1. Find a hyper-spectral profile from the hyperspectral database for a certain object (this kind of database exists?)
2. For each band get the object's gray-value from the profile, and treat this band as if it is gray-scale image when creating simulation image.

I am not sure whether this is the right way of generating simulation images. Any ideas?

• I don't get it why you represent the RGB image with a grayscale image. Dec 25, 2015 at 13:21

The spectrum of an object is typically a product of the spectrum of the light coming from a light source and the reflectance spectrum of the object. For visible light, I have an old collection of both of those, in the data.txt file in this jar archive. For example:

canvas;
number=1067;
category="food";
reference="Eastman Kodak (Ron Gershon)";
start=390;
step=2;
evendata=0.0465, 0.0470, 0.0446, 0.0444, 0.0443, 0.0440, 0.0435, 0.0433,
0.0435, 0.0433, 0.0432, 0.0431, 0.0442, 0.0435, 0.0438, 0.0444,
0.0446, 0.0449, 0.0454, 0.0459, 0.0464, 0.0467, 0.0467, 0.0469,
0.0476, 0.0479, 0.0487, 0.0490, 0.0496, 0.0502, 0.0507, 0.0511,
0.0515, 0.0521, 0.0527, 0.0532, 0.0542, 0.0550, 0.0557, 0.0567,
0.0576, 0.0584, 0.0592, 0.0603, 0.0612, 0.0622, 0.0631, 0.0637,
0.0657, 0.0666, 0.0677, 0.0690, 0.0703, 0.0719, 0.0730, 0.0744,
0.0763, 0.0778, 0.0802, 0.0813, 0.0823, 0.0845, 0.0861, 0.0874,
0.0906, 0.0921, 0.0940, 0.0961, 0.0979, 0.1001, 0.1026, 0.1047,
0.1071, 0.1094, 0.1116, 0.1140, 0.1165, 0.1192, 0.1222, 0.1248,
0.1272, 0.1302, 0.1327, 0.1357, 0.1387, 0.1413, 0.1443, 0.1478,
0.1507, 0.1540, 0.1573, 0.1600, 0.1632, 0.1667, 0.1699, 0.1735,
0.1768, 0.1799, 0.1834, 0.1872, 0.1906, 0.1949, 0.1983, 0.2021,
0.2062, 0.2104, 0.2143, 0.2184, 0.2228, 0.2266, 0.2306, 0.2343,
0.2391, 0.2432, 0.2472, 0.2518, 0.2557, 0.2597, 0.2646, 0.2688,
0.2732, 0.2779, 0.2818, 0.2861, 0.2909, 0.2952, 0.2997, 0.3045,
0.3086, 0.3124, 0.3171, 0.3220, 0.3259, 0.3306, 0.3349, 0.3390,
0.3441, 0.3483, 0.3528, 0.3574, 0.3624, 0.3667, 0.3716, 0.3766,
0.3811, 0.3863, 0.3908, 0.3954, 0.4011, 0.4058, 0.4105, 0.4162,
0.4204, 0.4249, 0.4299, 0.4350, 0.4404, 0.4455, 0.4495, 0.4543,
0.4589, 0.4631, 0.4684, 0.4724, 0.4764, 0.4818, 0.4864, 0.4906,
0.4958, 0.4989, 0.5037;


The spectrum is evenly sampled at 2 nm ascending steps starting at 390 nm. It is actually absorbance data which you need to convert to reflectance by:

$$\text{reflectance}(\text{wavelength}) = 10^{\text{-absorbance}(\text{wavelength})}.$$

For a light source, a common choice is CIE D65. Its power spectrum in 10 nm bands starting at 300 nm is:

0.0341, 3.2945, 20.236, 37.0535, 39.9488, 44.9117, 46.6383, 52.0891,
49.9755, 54.6482, 82.7549, 91.486, 93.4318, 86.6823, 104.865,
117.008, 117.812, 114.861, 115.923, 108.811, 109.354, 107.802,
104.79, 107.689, 104.405, 104.046, 100, 96.3342, 95.788, 88.6856,
90.0062, 89.5991, 87.6987, 83.2886, 83.6992, 80.0268, 80.2146,
82.2778, 78.2842, 69.7213, 71.6091, 74.349, 61.604, 69.8856, 75.087,
63.5927, 46.4182, 66.8054, 63.3828, 64.304, 59.4519, 51.959, 57.4406,
60.3125

• Thanks, and it helps me to understand hyperspectral profile. However, my question is more about using the profile to create a hyperspectral image. I want to create a simulated hyperspectral image with noise, and then perform denoising algorithm on it. After that, I want to compare the performance of different denoising method. Dec 23, 2015 at 22:01

An uncompressed format is just an array with as many values as there are recorded bands, from lowest to highest frequency, and every array of bands is kept in another array of XY graph values. If you get color images in rgb and convert to cmy format you will have 6 bands for a simulation. greyscale is just a single band, it makes more sense to display each band as a color, and then you can scan through the bands gradually and display them as rgb, hyperspectral photos are better in rgb representations.

A camera CMOS has three sensors per pixel, R,G,B, which can be stored in about 20 standard color formats, 8-16-24-32 bit, rgb, rbg, argb, rgba, DXT compression, so forth.

A hyperspectral scanner typically takes a line scan which can sweep a scene and make 2d images from the hyperspectral lines, with many color bands, 5ms or 10ms bandwidth for example. You have to therefore record arrays with an entry for every band. generally hyperspectral equipment doesnt have 2d pixel XY type sensors.

Every spectral data format is different varying from 5 to 2048 etc wavelengths, but the bit depth is less crucial than with color photographs, in order to get meaningful results of chemistry, perhaps you can get away with 100 or 1000 values for every band, so you can compress based on that if you need compression.

Search for spectral array data, and spectral data compression, to have masses of info on the topic. its probably more challenging than jpeg compression.