This work is part of the KOMBISPEC project. Its goal is to detect mycotoxins in grain. The dust naturally generated during transportation and transhipping of the grain is filled inside a microfluidic chip. For each mycotoxin two detection cavities are provided. With a newly developed monolithic miniaturized plastic spectrometer a fluorescence signal is detected for each of them. Additional cavities are added for referencing. Each cavity gets its own fibre connection to the spectrometer and accordingly creating an output signal on the sensor. This setup allows for relative measurements with the independence from variations and aging effects of the light source. The spectrometer made of plastic is especially endangered to errors caused by temperature drift. The fibres could also change their characteristics. The temperature drift possibly created by the light source or other external sources do not corrupt the results because of the relative measurement. Common spectrometers are built with a line sensor. This only allows the analysis of a single signal. Figure 1 illustrates how a spectrum which fits the sensors looks like. Figure 2 illustrates a spectrum with an inclination, figure 3 a spectrum with a bend and figure 4 a spectrum with a bend and an inclination. Only the sensor of Figure 1 would deliver a correct result. In the other cases parts of the information is lost and this leads to incorrect results.
For a multichannel approach either multiple line sensors or a matrix detector is needed . In the experimental setup a matrix sensor is chosen in order to detect the individual spectra. This adds the possibility to detect errors. Figure 5 illustrates that inside the sensor area the spectrum may have any form imaginable and it is detectable. If the task only would be to detect continuous spectra the solution would be easy. Figure 6 illustrates the case of spectra which mostly consist of light of the wavelength of red and blue. Without knowing more information, one could think that three spectra are inside the sensor area. Then reading the orange marked line would deliver a reasonably good result.
The advantages of analysing all spectra on a matrix sensor come with the drawback of a more complex analysis process. In the sensor area space is needed for the spectra themselves and enough in between them so they do not interfere with each other. The spectra can vary in the detected wavelengths and intensities. As the production of the miniaturized spectrometer is at an experimental state, distortions in the surface of the mirrors and the grating may differ the exact position and form of the spectrum on the sensor.
For capturing the image an IDS UI-3292SE-M camera with Sony IMX267LLR-C sensor is used. This camera provides a resolution of 4104 pixels x 2174 pixels with a bit depth of twelve. The spectrometer is designed for an area of 10 mm x 4 mm. The optical area of the camera is 14.158 mm x 7.500 mm. Accordingly, only 70 percent of the length and 53 percent of the width of the sensor area get used. The spectrometer is expected to have larger deviations from the set specifications than common spectrometers made of glass. This is because of the new plastic approach. Therefore, the exact form and position of the individual spectra will vary. All of these expected deviations have to be allowed for by the software.
The software is written in C++. For the image processing OpenCV version 3.2, a BSD-licensed open source computer vision and machine learning software library is used . For testing purposes, the software is not only able to acquire images from the camera directly, but also to load images from a hard drive. This opens the possibility to not only develop a solution for the current prototype of the spectrometer but also a more general solution for multi-channel spectrometer. The aim is to have a software which works without any kind of user interaction automatically.
The solutions are developed and compared with the main goal of reliably detecting the spectra. The result is a compromise between the most accurate result and the time necessary to achieve it. There is no limit for the time available in general. But the implementation in a point of care system demands to keep the needed amount of time short if it is possible.
In general, the task can be seen as a segmentation and grouping problem. First all the information available is getting detected. The information in this case are pixels with a higher intensity. In a next step the found information belonging to the same spectrum are grouped together. Before gathering the information, it is an expedient to eliminate common errors . Easily manageable errors are for example dark noise and hot pixel. Dark noise and scattered light are detectable by taking a reference image with no active light source. This image gets stored internally. For the actual image acquisition the pixel values of the stored image gets subtracted from the current pixel values. Usually camera manufacturers deliver an internal function for removing pixel errors such as hot pixel. The same method is used by the manufacturer functions . These operations decrease dark noise and hot pixel errors to a very low level. They do not have any significant influence on the result after it. For the actual search for information, a first and obvious step is to divide the image into different regions. Each region is defined to contain exactly one spectrum inside the set boundaries. Then the detection of this single spectrum should be easy. But as figure 6 illustrates, this can lead to difficulties if the spectra are curved. A rectangular fitting box could lead to problems, when the inclination and distortion is very prominent. Due to necessary safety margins around the expected positions of the spectra the fitting boxes could overlap. To prevent this unwanted behavior, an alternative approach is chosen.
First all points of interest get detected. For every fifth line the pixel values get analyzed. The limitation to only every fifth line is depended on the pixel size relative to the size of a signal and cannot by generalized. Skipping lines is improving the processing time. Additionally, this task is easily dividable for a multithreading approach. Figure 7 and figure 8 show a selection of 256 pixels of one line and their intensity values.
Figure 7 shows the raw data. Figure 8 shows the same image, but a 3x3 sampling window median filter is applied before the analysis. In order to get the position of a spectrum in a certain line the peaks of the intensity values have to be determined. The number of peaks in the given example is known to be two. For each pixel the dominance gets calculated. Dominance is a term of the geography and describes the distance to the next point with a higher value. The line of a sensor is a two-dimensional problem, so the dominance is calculated for the right and the left direction. The edge of a section is a special case. As there is no value following, the dominance in this case is infinity. Another thing to consider is, that if two point next to each other have the same intensity value and they are in the middle of the line, both would get the highest dominance score. So there needs to be set a minimum distance between two peaks. The coordinates of the pixels with the highest dominance get saved. When doing this for every selected line, in the end there is a collection of coordinates that belong to a spectrum. Which one is not determined yet. This part so far can be seen as a segmentation problem. Next the single points are being grouped. The amount of the spectra is known. Further the width of a spectrum plus a safety margin can be estimated. With this knowledge the list of points is cycled through. If a fitting group is found, the point gets added. If not, a new group is created. The belonging to a group gets valuated by the average lateral deviation to the mean of the existing entries and the deviation to a trend line which indicates the current direction of the last added points. The exact amount of points taken to create this trend line is dependent of the image size. When all points are sorted into a group a quadratic regression curve is getting calculated. To assure to get the best fit for the clearest spots, the points are being weighted by their intensity. Figure 9 shows an example of an image with five spectra. In orange the position of the spectra is being shown. Cyan dots are pixels which are being used for the calculation. Red dots are pixels which get ignored because they are too far of the curve and not significant enough. The exact values to determine weather a point is significant or not are still to be determined.
This paper describes the challenge of detecting multiple spectra on a matrix sensor when the exact form and position of them varies. With the combination of pre-determined sectors and the quadratic regression a reliable solution is found to solve this challenge. In a following step the correlation of the intensity and the position can be determined as well as the correlation of the wavelength and the position. To achieve this the signal of a calibration light source is needed. Non linearities get also covered by this procedure. As the final hardware is not available yet, the parameters are still in an experimental state and will be revisited in a following alteration.
Acknowledgements: This work has been developed in the framework of the project KOMBISPEC, a project of the photonics research Germany financed from the Federal Ministry of Education and Research .