Reliable Colour Detection for Matching Repaint Application

This paper presents the design and development of a system that creates the optimal conditions to sense colour for matching repaint application. The effectiveness of eliminating, and then recreating the lighting conditions to a desired level in a controlled enclosure is explored. The desired artificial light is introduced into the enclosure, providing optimal, constant conditions to measure surface reflectance. The tests conducted showed that the proposed system worked well. The testing results were good and showed that the relative results between samples taken at exactly the same location were an accurate match and consistent.


Introduction
Paint is commonly used to enhance the appearance of cars and buildings, both internally and externally.During its lifetime paint is exposed to a number of situations that can alter its original appearance; these include weather, scratching and graffiti.Scratching and graffiti are typically localised damage.Therefore in theory to restore the affected area to its original appearance a repaint is required with the same paint mixture originally used.However, there is the problem that damage caused by weathering affects the entire painted surface, and its appearance is globally altered, requiring the whole surface to be repainted in order to restore its consistent appearance; this method can get expensive depending on the area needing a repaint.Alternatively, an undamaged area of the surface to be repaired can be analysed to obtain its current appearance and a custom paint mixed accordingly.Currently the industry best practice for doing so is manual analysis by a trained artisan who visually matches the colour to a pre-specified DOI: 10.4236/wjet.2019.71009130 World Journal of Engineering and Technology range of paint.There are automatic means of analysing the appearance but they are complex and so consequently cost a lot.
During this research work, light was researched, i.e. lighting conditions and their effects on colour.Light is the key source of energy that feeds all life on Earth and we use it to get information about our surroundings and what we are doing.Light is a type of "energy" and is thought of as being carried by photons which are elementary particles, from a basic point of view responsible for the electromagnetic phenomenon [1].These photons are the transporters of all rays of radiation.The transfer of energy for one photon is described in the equation below: The energy in a wave is proportional to the intensity, frequency and speed of the light.
This energy can be measured with the use of Cameras, spectrometers, and other commercially available sensors.Sensors usually have different sensitivities to the different wavelengths of light which are usually described in their datasheets.
Al-Bahadly and Berndt [1] reported using LEDs emitting wavelengths that sufficiently overlapped and the intensity of the reflectance from a test piece, subjected to each different wavelength measured by an LDR.It was found that the system worked and the reflected wavelengths could be sufficiently sampled, the system was just a prototype and so requires more calibration, testing and elimination of noise to become viable.Al-Bahadly and Darhmaoui [2] proposed a camera based method for colour detection and associated software to convert RGB colour space to CMYK colour space.It was found that the system gave fairly consistent results at varying viewing angles, but they note that some factors would influence the results such as light, temperature and cleanness of test piece.They recommend that optimal conditions for image capture be found to better accuracy and that it could be considered a colour constancy problem, in which illumination is kept constant.S. Li and Pandharipande [3] reported using an RGB LED as both the light source and light sensor, here an array of RGB LEDs connected in parallel was used to sense the colour while simultaneously illuminating without perceivable flicker, and relay the colour to a destination RGB LED.Included in the experiment was an algorithm to detect arbitrary colours, showing that it is possible.
Although not directly related to colour detection for the purposes of repainting, this experiment highlighted the fact that a single RGB LED could be used to both illuminate and detect colour, although for the concept to be viable for the pur-World Journal of Engineering and Technology pose of repainting it needs to give reliable results, which could only be achieved if environmental illumination is kept constant.
Polzer, Gaberl, Davidovic, and Zimmermann [4] proposed a system where a BiCMOS colour sensor is used without colour filters to detect colour illuminating from an RGB LED.The system relies on the fact that silicone has wavelength dependent penetration depths.By taking photocurrent reading at the appropriate depths one is able to determine the intensity of red, green and blue light cast on the sensor.Again although this is not directly related to colour detection for the purposes of colour detection with slight modification it could be applied to the application and would also greatly benefit in the application if external illumination were to be kept constant.
The paper focused on devising a method for eliminating the ambient light and recreating the desired lighting environment.The method was realised in a variety of different ways and configurations.Each configuration was an improvement of the last, leading to an optimal final design that was used to be used for testing.

Research has been conducted to determine what advancements have been
made with respect to colour detection and what applicable technologies are available.Apart from the current expensive spectrophotometers on sale, the research showed that cheaper alternatives such as those using cameras [2], were unreliable.
The reason for this is because they have no control over the lighting conditions in which they analyse the colour.The designed device must solve this problem.
The tests conducted showed that the device/method worked.Samples within tests had little to no colour variation.There were issues with the consistency of the measurement device.The settings in manual mode were not always the same even though they were set to the exact same level, making it difficult to get compare between tests run at different times.

Light and Colour
Light is responsible for the colour we see.Lights electromagnetic wavelength falls between 380 nm (violet) and 780 nm (red) [5].White light is made up of approximately equal proportions of all visible wavelengths.When these shine on or through an object, some wavelengths are absorbed while other are reflected or transmitted.
If the white light source is deficient in the wavelength that a surface reflects, the colour of the surface will appear different to what it should be.This can be clearly seen in Figure 1 where the reflected spectral power distribution changes as the incident spectral power distribution changes.The reflected spectral power distribution is only the same as the percent reflectance if the incident spectra are evenly distributed [6].

Selecting a Source of White Light
For this problem the main concern is reproduction of colour.Over the past 80 World Journal of Engineering and Technology years, the sources of choice for colour reproduction have been sunlight and tungsten-based light [7].Both these lighting sources have a relatively even distribution of energy across the spectrum with no large troughs or peaks in output at any wavelength in the visual band.This makes them great sources of illumination if colorimetric accuracy is desired since they both have a colour rendering index (CRI) of 100 [8], this is shown in Table 1.
According to [8], Figure 2 shows the use of a tungsten bulb is the common choice for colorimetric accuracy.They generally have lower spectral distribution in the lower wavelengths (blue light).This gives the yellow appearance of most tungsten filament bulbs.This is not true for all tungsten based lights.There is a series of Tungsten halogen bulbs currently made by Tailored lighting, Inc. called SoLux that has a spectral distribution closely matching that of the sun as demonstrated in Figure 3 while having a CRI of 99+ [9].

System Design
From research, it was evident that there was a lack of control over the lighting conditions during the detection of surface reflectance.The literature highlighted that digital techniques for determining colour constantly were only suitable for object detection where it was acceptable for the colour to be distinguishable as a known colour, but would not be able to return the colour exactly under all lighting conditions [10].It showed there had been success in the medical field detecting, low energy luminance by eliminating unknown lighting from the detection area [11].This led to method of doing just this, but to measure reflectance.

Mechanical Design
An enclosure with artificially introduced lighting concept will be used to consistently analysecolour.There are many aspects that must be designed and tested for it to give the desired reliable results.
The focus of this research work is to verify the use of an enclosure that eliminates light and introduces new light as a reliable environment for colour detection.Detection within the environment should be able to give the same results on the same surface and location, irrespective of when it is tested and the external lighting conditions it is tested in.Therefore, the lighting used was not the optimal lighting to be used if exact colour was to be rendered, nor was the use of an iPhone camera intended to be the analysis device if exact colour were to be detected.
The lighting used allowed the effective testing of the lighting location on the surface reflectance.The lighting conditions could be repeated, giving the same results.It was easy to change the location of the bulbs and test what effect this had.
The iPhone camera was used with its settings in manual mode to analyse the reflectance of the surface at a certain location within the enclosure.It was, as with the lighting able to give accurate results relative to the previous samples in the same test, but not of the actual colour without further calibration which is outside the scope of this project.The use of an iPhone camera introduced many design elements into the enclosures designed.The height, width and depth were all determined by the cameras field of view and focal length respectfully.If a simple RGB sensor were used for the detection device, the dimensions of the enclosure would have been drastically reduced.

Design Testing
To test the qualitative performance of the designs, three surfaces were chosen with different properties.A textiles surface in the form of a purple t-shirt (Figure 4(a)) was chosen to determine the performance of a matt surface where little direct light reflectance is expected.An artificial wood vinyl surface (Figure 4(b)) was chosen to determine the devices performance on a medium gloss surface where some direct light reflection is expected.A shiny blue folder (Figure 4(c)) was chosen to determine the performance of the device on a high gloss surface where a lot of direct light reflection is expected.This high gloss surface was chosen due to it similarity to the gloss level of a typical cars paint job.

Prototyping and Final Design
In order to get to the final design, there were three prior prototypes.Each one of these prototypes improved on the last.The initial designs design for an enclosure stayed throughout the prototypes.The main issue that the first prototypes experienced was point lighting as shown in Figure 5.It shows the point lighting form the first prototype where the iPhone flash was used as the light source and represents the worst point lighting experienced from all prototypes.World Journal of Engineering and Technology  Prototypes two and three used three tungsten filament bulbs coming from the top of the enclosure, and passed through a diffuser.
Prototype two still had point lighting, and even though it wasn't as bad as the first porotype it presented no clear sampling area where the surface reflectance stayed constant.
Prototype three improved on prototype two by incorporating reflectors behind the diffuser to distribute the lighting around better.While this did distribute the lighting better, it resulted in a large area of direct light reflectance, and only left a small area that would be appropriate for sampling as shown in Figure 6.
The final design came after the third prototype and is called the final design as it gave the best results.
The purpose of this design was to improve on design three by moving the lighting closer to the sides, thus moving the direct light reflection points closer to the sides and creating a larger area of constant lighting for colour detection.areas of constant illumination, the area of constant illumination for these surfaces will be the same as the defined area.However, Figure 8(c) shows that there is now a larger, square area where lighting does not change.This area would be large enough to average and get an accurate colour reading from.

Results and Discussion
To get quantitative results for the chosen design, MATLAB was used.A program was written that takes a jpeg image and extracts the red, green and blue channels into their respective arrays.The arrays are then iterated through at a desired location and the red green and blue values averaged to return their respectful averaged results.The averaged area is shown as the red square in Figure 9.
The best design from the results was selected to do testing.The test piece for   The iPhones built in camera app sets white balance, shutter speed and ISO speed automatically to what it thinks it should be to get an optimal photo.This is a problem if you want consistent results because these setting will change from one surface to another.Therefore, two-third-party app was used on the iPhone to control the white balance, shutter speed and ISO speed.Unfortunately, both apps were not reliably able take photos that with the same colour balance even with the settings set to the same for all photos.If the camera had been looking at a bright object in automatic mode before it was set to manual mode and the settings changed to the desired level, the resultant image would be brighter than if it had been looking at a dark object in automatic mode before being set to manual mode and the settings taken to the same desired levels.
Once the camera is set to manual mode, all the images taken during this time were found to have the same characteristics and could be compared with one another to determine relative colour accuracy.

Blue Folder Different Locations
Figure 10 shows the average colours of the samples taken at different locations on the blue folder one after another with the lights in the room on.
The results from the samples vary slightly.However, the variation is almost indistinguishable by the human eye.The human eye can distinguish about 10 million different colours [12].However, an 8-bit JPEG image can distinguish between them: World Journal of Engineering and Technology

Blue Folder Same Location Lights-On
Figure 11 shows the averages of the samples taken at the same location.Consecutive samples were taken at the location with the room lights on and then with the room lights off.Each sample was a minute apart.
The results vary quite a bit from those of the samples taken at different locations.This is due to the manual control issues with the camera as explained in Section 4. The results were really good when looking at them, there was no variation between samples.

Blue Folder Same Location Lights-Off
The result with the lights-off varies with the lights-on but, again there was no variation between samples as shown in Figure 12.

Overall Discussion
The results of all the tests were good.The tests have shown that the relative results between samples taken at the same location were a 100% match.Since both the lights on and light off at the same location had no variation between them, the variation between samples in the varying locations test, can be put down to differences in the actual surface reflectance at those different locations.
The difference between the lights on and lights off values is unknown.If the enclosure was letting in external lighting, then you would assume turning off the  lights would decrease all some of RGB values, however the red and green channels were one value higher each.It may be because the enclosure moved slightly after turning of the lights and so a slightly different location was sampled.

Conclusion
The design and development of an enclosure that creates the optimal conditions for colour detection has been described in this paper.The enclosure stops all external light from entering it, and artificially recreates the lighting conditions to a desired level for colour detection.An iPhone camera is then used to capture an image of the surface and MATLAB used to process the image and find the average RGB values.The results were good between tests as long as the camera was not turned off between them.The results were always stable between samples in tests, which proved the fact that the enclosure provided a constant lighting environment for colour detection.To further verify the effectiveness of the enclosure it is recommended that a full control over the conditions is required so that the reliability between tests is established.

Figure 1 .
Figure 1.Effect of incident spectra on the reflected spectra.

Figure 2 .
Figure 2. Spectral distribution of common light sources.

Figure 5 .
Figure 5. Bad point lighting from the first prototype.

Figure 7 (
Figure 7(a) shows the top and side of the final design.Figure 7(b) shows the

Figure 7 (
Figure 7(a) shows the top and side of the final design.Figure 7(b) shows the bottom of the design with the lighting turned off.As can be seen the lights have been moved to the side and a fourth light was added to more evenly distribute the lighting as shown in Figure 7(c).
these results was the blue folder used during the design stage.Pictures were taken and the average colour data from the sample area calculated, compared and displayed.The difference in RGB values of picture samples taken within tests determined the reliability of the results.World Journal of Engineering and Technology

Figure 8 .
Figure 8. Final design test results; (a) Purple t-shirt test, (b) Wooden desk test, (c) Blue folder test.

Figure 9 :
Figure 9: Colour Sample for test pieces.

Figure 10 .
Figure 10.Blue folder colour samples taken at different locations with the room lights-on.

Figure 11 .
Figure 11.Blue folder colour samples taken at the same location with the room lights-on.

Figure 12 .
Figure 12.Blue folder colour samples taken at the same location with the room lights-off.

Table 1 .
CRI of common light sources.
*Efficacy reduces with increasing power.