Polarising Results

Inspecting transparent objects is a common task in computer vision. One approach is the use of polarized light: In general, polarized light is sent through the object to be measured, passes a second filter in front of a camera and the result is recorded for further processing (the Vision Doctor site offers a good introduction and overview of different applications).

Polarizer demo setup

 

Fig.1: Setup with polarised display in the back, measured object, camera and STM32MP1 analysis software

We have built a demonstrator for a transmitted light analysis to explore essential parameters, such as minimizing lighting changes: A common LCD display with the front polarizing film removed was used as the polarized light source (thanks to the helpful team from TSLCD!). This enables a quick change of the polarization orientations by displaying a white or black image, but also individual areas of the polarization can be changed depending on the image displayed.An aluminum construction kit (OpenBeam) and 3D-printed adapters ensure a stable setup to mount the display plus driver board and camera stably:

The board camera in the foreground is connected to the STM32MP157 development kit on the right in the picture. The camera focuses on the ruler, which is fixed a few centimeters in front of the display, the LCD is slightly out of focus, otherwise the individual pixels would be recognizable. A polarization filter is placed directly in front of the camera lens, resulting in an image that represents the rotations of the polarisation plane as different color gradients.

Polarizer Demo Rückansicht - Blick auf die Kamera mit Filter

Fig.2: Back view - the polarisation filter is only losely placed in front of the camera lens.

A small OpenCV program continuously records images, initially saves a reference picture and calculates the absolute difference pixel by pixel whereby the color gradients, which represent tensions in the material, are clearly visible:

0 and 90 degree polarization, sum and difference images

Fig.3: Polarized images, sum and absolute difference

In the picture above are the images polarized at zero and 90 degrees, in the line below the sum and (absolute) difference picture. Since we used a standard camera without configuring it further, there are smaller artifacts that can still be easily eliminated, as an example, the auto white balance algorithm of the camera is responsible for the different color tones of the two original images.

The difference image can be further processed, for example by transforming it into another color space that separates brightness and hue data this is shown using the example of RGB -> Luv:

Konvertiert in den LUV Farbraum, rechts unten abs(U-V)

Fig.4: Difference image separated into the Luv color space; lower-right: absolute difference of U and V

In this representation, scratches are clearly visible on the surface in the brightness image (L), while they are practically invisible in the hue planes.

Areas of high material tension differences are characterized by many color changes per area, which can be determined, for example, by edge detection. Exemplarily, we use a Canny detector on the above images which provides the following results, which e.g. can be compared with reference measurements:

Die einzelnen Farbebenen nach der Kantendetektion mit Canny

Fig.5: edge-detection results

As shown, polarization applications can be tested without much effort before looking into a specialized hardware solution e.g. cameras based on the Sony Pregius sensor IMX250MZR (p.ex. ThinkLucid). With the polarized display, the polarization orientation can also be finely adjusted by selecting different gray levels on the display, which can bring additional advantages for surface inspection, for example.

The code for the demo is on Github under voxel-dot-at/polarisation-analysis