DIY Hyperspectral Imaging VIS-NIR

There are a couple of approaches to hyperspectral imaging, in this post we will look at my (partially) DIY solution for a portable pushbroom hyperspectral imager for 520-930nm wavelength range.

For the record let's just list some other solutions too:

  1. The CMOS/CCD sensor is coated directly with a spatially variable bandpass filter or the filter ins mounted as a window.
  2. The light passes through a stop where a liquid crystal or piezo variable filter is used to tune the wavelength.
  3. A simple pinhole spectrometer is scanned in XY through the scene (whisker broom).
  4. A square aperture in combination with a 2D grating and linear unmixing is used to build a data

(5) Pushbroom hyperspectral imager.

There are a couple of Do-It-Yourself articles on ResearchGate available which list one or the other type of imagers available to build for enthusiasts. The total budget is around 500-1000-1500USD depending on the approach. This is a very friendly price compared to imagers from the big names in the industry who sell their solutions for 20-100kUSD. While the pure DIY solutions are perfect for understanding, corrections for aberrations and most importantly for smile and keystone is not an obvious task.

I decided to build my own hyperspectral imager using the pushbroom method. This includes a imaging spectrograph (a spectrometer with a slit, corrected for smile, keystone), a objective lens (fore optics) and a 20MP CMOS industrial camera. The spectrometer basically selects a line from the scene and every point of the line will have the spectra.


The spectrograph is an older model from SPECIM (Imspector V8E) which I bought for 800USD on eBay. This version has a exceptionally low keystone, smile and very good spectral and spatial resolution. The objective lens is a Xenon-Topaz 25mm 400-1000nm coated from Schneider-Kreuznach, useable up to 12MP. (About 800USD new or 400USD used) The camera is 20MP 1" monochrome Blackfly GigE from FLIR (ca. 600USD new.). The subtotal is about 2000USD. Only subtotal because there are a few accessories which will be needed for portable use. These accessories are: A mount for the imager, a tripod, rotation mechanism, PoE injector for the GigE camera, portable 220V power bank for the injector, cables, a heavy-duty case for the whole set. That adds altogether about 800USD to the budget and makes a total of 2800USD for the imager.

A later realized that I could have saved money on the power bank and the PoE injector if I buy a USB3 camera. You should definitely do that if you plan building your own based on this guide.

hyperspectral imager set pushbroom

From the datasheet of a similar V8E model:



Setting up the spectrograph

The Imspector V8E is a smart little device, you just have to screw on the lens on the front and the camera on the back. Both are C-Mount so it is basically a special attachment compared to a regular industrial camera setup. The lens side is nothing difficult, you just screw it on. Make sure of course that there are no particles on the entrance window and on your lens. The iris should be set up to F2.4 so it matches the spectrograph's F-number. Focusing is done just like on other manual camera lenses, you turn the focusing ring on the lens and observe the lines on the image. If the lines of interest get very sharp, you found your focus.

Adding the camera to the imager is less obvious. The CMOS sensor should be in the image plane of the spectrograph. If you bought a used Imspector, most likely the previous user set this up already. Otherwise download the imspector manual from the internet. The other important thing is to have the spectral and spatial axis perfectly aligned with the sensor's X-Y pixel axis. The spectrograph has an extremely low keystone/smile (maximum 1.5um!) so to use its full capability you will have to align it right. For that you shall use a piece of paper with a fine black grid printed on it. This will give you spatially repeating lines on the image. I set this up manually 10-20 times using a crosshair on the image and analysed the alignment by plotting pixel values along the vertical axis.

spatial and spectral axis


Setting up rotation

The rotation mechanism is needed to do the full image cube. The spectrograph records only one line of the scene at the time, remember? For rotation I used a Syrp Genie Mini. You can basically set up the speed of the rotation via Bluetooth, it has a battery and a lot of different rotation options. Before recording anything, you would want to set up the rotation angle and speed so it matches your target horizontal pixel number and camera frame rate. If you don't record at the right speed, you will have a hard time later resizing / resampling thousands of high-resolution images. ;) Also, the Genie Mini can handle up to 3kg weight and the imager weights about 2kg so make sure you get something professional - something from AliExpress just won't do.


Camera settings

This will depend on what you want to use your spectrograph for. I used it mainly for photography. For that, you will need a fixed exposure in the settings. A variable exposure (for full image or area of interest) will cause lines in your reconstructed image, but would collect at much light as possible for spectra evaluation. Lines are later very hard to remove. The ENVI software has a built-in feature which removes line on hyper/multispectral images but this is never perfect. The gain should be set up as low as possible on this camera. Some image sensors have a lower noise at a specific (not 0) gain level, but this is not the case with the 20MP Blackfly camera. The fixed exposure time can be set up by doing some quick (10-20s) trial rotations on the Genie Mini and looking out for saturated pixels during the rotation. Again, it's not easy to process the images later by changing contrast and brightness because you have to consider hundreds of high-resolution images, so you better spend some time setting this up before recording.



Do a quick checklist before recording. Exposure, rotation speed, rotation angle, gain, focus, horizontal alignment, image format, image bit depth, frame rate set up right? Yes? Start recording.

Depending the frame rate, it can take up to 20-30 minutes to record data for one hyperspectral data cube. Likely a few GB of data to process later.


Processing data

Unfortunately, there is nothing commercially available for this. I wrote my own software for reconstructing the data cube in Matlab and can supply it on request to anyone. At the beginning you have your raw data which is many spatial-spectral images. You want to have spatial-spatial with many spectral layers.

First of all, the spectral axis has too many data points (about 5000 for a 20MP camera). The spectral resolution of the spectrograph is about 3-6nm and 5000 points means about 0.08nm per pixel: this will need resampling. I did the resampling with Lánczos algorithm; this gives a way better result than just moving average. It takes some time however to set it up properly.

Then you will have to rearrange the data (spatial-spectral to spatial-spatial) and export it to a common data cube format. Multilayer tiff (tif) is widely used easy to build and lossless. Tiff format is also useful later if you want to analyse the data in Scyven.



Analysing data

There are a coupled of paid software for this and a lot of analysis opportunities. ENVI is probably the most advanced, Scyven is basic but free, Leica Geomatica is paid but an alterative. Using ENVI you can remove lines, do panchromatic sharpening if you have a high-resolution photo of the same scene, export and import a lot of different file types, match spectra with a database and more...

Most users will only need Scyven. There is a short introduction video how to use it, it's relatively easy. You can identify the main materials, analyse spectra by pixel, normalize data, show different representations of the image. If you want to do it right, you will need a reference reflector on your scene. This is a white sheet which you also record during the data collection. This white sheet has a constant reflection at all the different wavelengths and allows you to record the spectra of the light source. If you know the spectra of your light source, you can recover material reflectance. At outdoor imaging your light source is likely the sun, but not everything fill have a direct and homogenous illumination and they will be also at different distance from the imager. So just for hyperspectral photography it makes not much sense for me to use the reference white. 

 If you have any questions or need help with your project, contact We are happy to help.

Now, enjoy the little hyperspectral video of a mountain in the alps: (time axis = spectral axis)


Good luck!


Leave a comment

Please note, comments must be approved before they are published