1 Introduction

Over 1.35 million people in the world die per year because of road accidents. Almost 3700 people are dying every day in the world due to road accidents [1]. Every year, millions of people are injured or handicapped and suffer lifelong effects of their injuries due to their damaged body parts. A huge percentage of road accident occurs during the evening (18:00–21:00 h) and night-time (21:00–06:00 h) in the absence of sunlight. Collisions at night for police and public car (police = 76%, public = 58%) is higher than the evening time (police = 62%, public = 41%) and obviously more than the daytime (police = 44%, public = 31%) [2]. The high-beam glare of today’s powerful headlight blinds the eyes of a driver, which is the most dangerous situation for a driver during the night. Drivers are unable to see the road condition, road direction, an object on roads, and places around the road due to the high-beam headlight glare of oncoming cars. These are the main causes of road accidents during the night. The road view becomes opaque due to the following reasons. The first one is the high-beam headlight glare from opposite direction vehicle and the second one is a very low-light intensity and unclear view of the road due to darkness. People generally try to solve the first problem of high-beam headlight glare using color windshield glass.

Some people try to solve this using color spectacle or night-vision glass to solve the first problem. As a result, the color glass in a vehicle or spectacle sometimes reduces the high-beam headlight glare a little bit, but it also increases the second problem more. The view of the road gets darker, which becomes very dangerous for driving. So, the use of color glass is not a good solution as it increases one problem, but decreases another. A pair of human (driver) eyes can have a clear vision if the situation of the environment is proper in all aspects, but, it is very rare at night. Therefore, a night-time assistant system for the driver is very essential to ensure safety during the night. Researchers thought of applying image enhancement techniques to resolve the problem of high-beam headlight glare at night. There are various image enhancement techniques to uplift the quality of a digital image by manipulating the attributes [3,4,5]. Among them, the global image enhancement method is most widely used where the whole image is considered for manipulating the attributes. Whereas the local image enhancement technique considers only a few specific parts of an image to manipulate the attributes [6]. Few car companies are recently using a dash camera (Dash-cam) at the front of the car to acquire live video for image enhancement to solve the night-vision problem faced by a driver. However, even after using the image enhancement technique, it does not solve the actual problem. When a high beam of light comes from any oncoming vehicle it tries to diminish the intensity of the headlight beam. But, as a result, it also decreases the light of the road view along with the intensity of the headlight.

In this paper, a region-based local image enhancement technique is proposed to improve the clarity of the road view by dimming the headlight glare in run-time. This can help a driver and also an autonomous vehicle for driving at night.

The primary contributions of this paper are summarized as follows:

  • Region-based distinct local image enhancement techniques are applied for three separate regions of every frame. It will provide a bright road view along with dim headlights of oncoming vehicles at the same time.

  • To reduce the huge processing time, frames are classified into two states. The value of atmospheric light (A) is recalculated only when a new state starts.

  • A dynamic-patch based novel low-light vision enhancement method is introduced for low-light region. A smaller patch size is provided to darker pixels. The use of dynamic-patch overcomes the problem of over enhancement for the dark and the sky region of frames and provide prominent bright output for the road and the surrounding region.

  • To reduce huge computation time, the adaptive Gaussian filter (a post-processing step) is not applied to the entire frame, it is applied only on two common boundary areas of three regions. It smooths the border of regions if the frame is segmented into three regions due to the presence of any oncoming vehicle.

  • The proposed method outperforms state-of-the-art models for all types of frames in real-time at night.

The residual portion of this entire paper is systematized in the following way. Section 2 defines related work, Sect. 3 presents the proposed methodology. Section 4 describes experimental results and processing time analysis followed by a conclusion and the future scope in Sect. 5.

2 Related work

Night-time vehicle detection, pedestrian recognition, driver assistance system, and traffic surveillance system are the massive areas for research. A warning system for lane departure [7] is developed using a PCB board which comprises of a chip composed of one programmable logic and a microprocessor.

A flexible and low-cost solution for real-time correction of the fisheye distortion effect is presented for automotive applications [8].

A color point classification method is demonstrated [9] for the automotive applications in HIS (Hue Saturation Intensity) space according to the distance between projection of points to the respective SI plane. It can be used to perform a segmentation of possible obstacles (cars, trucks, vegetation, etc.).

A design methodology of a real-time embedded system is introduced [10] that processes the detection and recognition of road signs while the vehicle is moving. Region of interest was extracted using the Maximally Stable Extremal-Region Method. The Oriented FAST and the Rotated BRIEF features are used for the recognition stage.

An FPGA-based road sign detection system is proposed [11]. The system can support enough reaction distance in real-time driving condition up to the highest speed 110 km/h.

A gaze tracking system is presented [12] to monitor the driver’s sight-line using ESVIR and a succinct FC neural network. The system perceives the eye using basic patterns during pixel scanning. After the vertical evolution the evolved feature is comprehensible and can be sent to the FC neural network directly for pattern recognition.

A GPU parallel scheme is presented for nonuniform illumination image restoration [13]. Here, a retinex-based method is used to decompose the actual image into brightness and the reflectance components. Then, the brightness value is adjusted through the adaptive gamma correction followed by a non-parametric mapping to obtain the restoration.

Another GPU-based RCF-Retinex is introduced [14] which can accelerate the region-covariance filter using CUDA. The use of CUDA is reasonable to match the region-covariance filter because of its successive convolution operations. Hence, illumination images are obtained within the less computation time.

Whereas, night-vision of controlling of high-intensity headlight beam glare during the night is a challenging topic for the researcher as there is no control of another vehicle’s headlight intensity for a driver. Only a few research works are available in this particular field. Some related works are mentioned here.

Few researchers used a wireless control of headlight intensity using a light intensity sensor. If the sensor detects high-intensity light of oncoming vehicles, suddenly a wireless instruction signal is sent to the driver of the oncoming vehicle to dim the headlights manually [15].

Light-dependent-resistor (LDR) based high-beam light controller [16,17,18] is introduced to control high-beam headlight. If the controller detects high-intensity light, then it decreases the resistance of LDR. When the resistance becomes high, then the high-beam intensity light is set as ‘ON’ and vice versa.

Fuzzy logic based intensity controller [19] is established using a PIC Controller as hardware and the fuzzy logic toolbox of MATLAB software. Headlight intensity and distance of oncoming vehicles are detected using a fuzzy sensor. If the intensity exceeds a tolerance limit, then it passes to the controller. Fuzzification and de-fuzzification are completed according to fuzzy rules and membership functions using MATLAB fuzzy toolbox [20].

A wireless sensor network based headlight-intensity controller is introduced using a few wireless sensors, a controller, a gateway, and an analog–digital converter (ADC). A photo-resistor determines the intensity of the oncoming vehicle’s headlight. The ADC converts it to a digital signal and the controller regulates the headlight intensity accordingly [19, 21].

Intensity control via IR transmitter–receiver and a photodiode is established with a light-emitting diode (LED). Both the IR transmitter and the IR receiver are connected to the power supply of 5 V and 12 V respectively [20]. The IR transmitter detects the headlight intensity of oncoming vehicles and transmits to the comparator via the IR receiver. If the value is in a given threshold range, then switch on the high-intensity LED otherwise switch on the low-intensity LED [22,23,24].

Pulse-width-modulation (PWM) method regulates the intensity of headlights using a microcontroller. Here, three various web forms of various duty cycles such as 10%, 50%, and 90% are used. The microcontroller can control the light intensity by adjusting the power of the headlight [19, 25].

If we observe all the existing approaches, we can notice that maximum approaches are used to reduce the intensity of our own vehicle’s headlight beam, but the approaches are unable to handle the intensity of the headlight beam of oncoming vehicles. According to the existing approaches, if the sensor or camera detects any high-intensity light, then a signal is sent and the controller dims the headlight beam accordingly.

So, the problem will be in such types of scenarios where two vehicles are coming from the opposite direction and both the vehicles are having a very high headlight beam. In that case, if the first vehicle’s sensor detects the high-intensity headlight beam of the oncoming vehicle, then immediately the system reduces its headlight beam. Now the first vehicle is having a low-intensity beam and the second vehicle is having a high-intensity beam. As the first vehicle’s headlight beam is low, so the sensor on the second vehicle will not detect high-intensity light from the oncoming vehicle (already reduced the intensity of its headlight) and it will be unable to dim own headlight beam. Still, the driver of the first vehicle will face the vision problem. So, the sensor of the car, which detects the high-intensity headlight beam from the opposite car first, will face the vision problem and the other car’s driver will feel comfortable. This concept is barely relevant because sensors of two opposite vehicles cannot detect high-beam light exactly at the same time. Few researchers [15] tried to resolve the above problem using a light detection sensor by sending a request signal to the oncoming vehicle for dimming the headlights. After getting the request from the ongoing vehicle, the driver of the oncoming car may reduce the intensity of his/her headlight manually if he/she is a friendly person otherwise, the headlight-intensity remains high.

Hence, there are several ways to handle high-intensity head-light beam of own vehicles. Whereas, controlling the headlight beam of the other’s vehicle is quite impossible because no vehicle allows such a facility to control other vehicles.

Few researchers attempted to resolve the problem using the image processing technique [26]. Here, researcher tried to reduce headlight intensity to improve street visibility at night, but it reduced the light of the road surrounding view along with headlight intensity. Another image processing based automatic headlight-intensity controller is introduced [27] that assist drivers parking vehicles during the day and night time without colliding with any obstacles. This system is used to detect and track pairs of headlights of oncoming vehicles from color video using a low-cost camera.

Few models of many renowned car companies (such as BMW 5, 6 and 7 Series, Audi A8, Toyota Crown Hybrid & Landcruiser, Mercedes-Benz E, S & CL-Class, Lexus LS & X470, Cadillas DeVille, Honda Legend, etc.) nowadays uses the real-time camera (IR or Thermal) based traditional night-vision display on dashboard [28, 29]. These night-vision systems are based on image processing algorithms. But, these are unable to provide bright road views inhibiting high-intensity headlight beam at the same time. Enhanced vision by a night-vision system of a traditional car running on a dark road is shown in Fig. 1.

Fig. 1
figure 1

Night-vision system of a traditional car. a Original frame on a dark road at night with a high-beam headlight b enhanced vision

3 Proposed methodology

In this paper, a novel real-time night-vision system is proposed to solve the problem of the high-beam headlight of the oncoming vehicles with a minimum processing time. The proposed concept is based on region segmentation and region-based local image enhancement technique. Drivers can get a prominent and a bright road view along with dim headlight of oncoming vehicles at night. During the night, the driver’s view can be considered as a colored frame. A driver feels vision problem and temporary blindness only for some particular region or spot of the frame which contains the high-beam headlight of the oncoming vehicle. So, we need not worry about all the pixels of an entire frame, rather we can concentrate only on the particular region where the high-beam headlight is present. An entire frame is segmented into three separate regions. Region 1 contains very high-beam light intensity from an oncoming vehicle. Region 2 contains the glare portion of region 1 and region 3 represents the remaining region (excluding region 1 and region 2) which comprises the road and surrounding views. Then distinct treatments of image enhancements are applied for three regions (1, 2 and 3) separately. The enhancement of region 1 aims to reduce the high-beam intensity so that it will not cause any temporary blindness of a driver’s eye. Enhancement of region 2 aims to remove the headlight glare. Similarly, enhancement of region 3 aims to increase the visibility of the road and surrounding environment so that the driver feels a comfortable look. In region 1, the intensity of high-beam headlight is reduced by decreasing brightness using a masking function. In region 2, the gamma correction method is applied. Similarly, in region 3, low-light vision enhancement with dynamic-patch is applied. Finally, the adaptive Gaussian filter is used for boundary smoothing. The complete framework is represented in Fig. 2. Details of the entire proposed system are explained stepwise as follows.

Fig. 2
figure 2

Framework of the proposed night-vision system

3.1 Live video acquisition

Live video acquisition is the process of capturing real-time video that can be processed dynamically. In the proposed system, a high definition camera is installed in the front of a car and inside the windshield glass. It is used to generate an exact view of the road just like a driver’s eye. The camera can take a dynamic color video of 30 frames per second (fps) with an extreme resolution of 1280 × 720 pixels. Frames are extracted for region-based local image enhancement.

3.2 Oncoming vehicle detection

In real-time frames, oncoming vehicles are detected using SSD512 (Single Shot MultiBox Detector 512) [30]. The highest matching is picked where multiple higher intensity pixels are assembled in a round-shaped boundary. Whenever the system detects any headlight of oncoming vehicles in the frame, set the flag (a variable) value = 1 and the frame is segmented into three regions. Otherwise, set the flag value = 0 and the entire frame is considered as region 3.

3.3 Region segmentation

After frame extraction, each frame is segmented into three regions based on the intensity of the light beam if there is any oncoming vehicle with high-intensity headlight. Regions are: core headlight region (region 1), glare region (region 2), and the remaining region (region 3). If there is no oncoming vehicle, then no need to segment the frame. In that case, the entire frame is considered region 3. Here, a combined and modified segmentation algorithm is used. Every frame contains noisy luminance due to the high-beam intensity of headlight and high glare. Therefore, edge-based and region-based segmentation methods [31] are used to segment the region 1 and region 2 respectively.

A combination of two segmentation methods is used sequentially to get the best segmentation result. To extract the core headlight zone (region 1), the Canny Edge-Detector [32, 33] is used with a huge threshold sigma (σ) value of 100. The Canny Edge-Detector involves smoothing, finding gradients and magnitudes, non-maxima suppression, double thresholding, edge tracking, and linking by hysteresis [34, 35].

To extract the glare portion (region 2), the Seeded Region-Growing technique is used. Seeded Region-Growing technique [36, 37] grows up to a certain threshold value starting from few initial seed points by finding all similar areas of connected pixels with some homogeneous characteristics (such as intensity) [38, 39]. It Stops growing the region when there are no more pixels available that met the criterion to include in that region. The points on the border of region 1, are considered initial seed points. Finally, region 3 (remaining portion) is extracted. The segmentation progression is shown in Fig. 3. A comparison of segmentation of frames by a few popular techniques [31] is exposed in Fig. 4.

Fig. 3
figure 3

Process of segmentation of a frame with high beam and glare. a The original frame b core headlight portion (Region 1) is extracted c Glare portion (region 2) is extracted d three regions (1, 2, and 3) are segmented

Fig. 4
figure 4

Comparison of visual representation of output frames by few popular segmentation techniques [31] a original frame, segmentation using b Prewitt c Sobel d log Gaussian e Canny f proposed combined method

3.4 Region-based local enhancement

After segmentation, three different region-based local enhancement techniques are applied for three separate regions. As the aim is to provide a clear and comfortable vision for the driver during the night. Enhancement techniques for three regions are as follows:

3.4.1 Masking of high-intensity beam for region 1

Region 1 consists of the core headlight region with very high-beam light. The target is to reduce high-intensity light in such a way that the light will not affect the driver’s eye for vision. However, the driver should perceive the existence of the oncoming vehicle. Hence, the brightness of region 1 is reduced by a constant factor. A masking function is defined to reduce the brightness of each pixel (intensity > P1) by subtracting a positive constant value of 80 to make the pixels darker. Besides, it reduces the area of the core headlight region by 50 percent. The masking function that decreases the brightness of region 1, is shown in Fig. 5. Pixels whose intensity values are less than those of point P1, the resultant intensity remains unchanged. As each pixel is an eight-bit representation, henceforth intensity values are saturated at a maximum level of 255. The position of point P1 is finalized at intensity level 150.

Fig. 5
figure 5

Masking function to reduce the brightness of region 1

3.4.2 Gamma correction for region 2

The region 2 consists of the glare portion caused by the high-beam headlight. The target is to remove the glare and to see the clear road view. The intensity of a monitor screen, which emits light by a given input signal, is usually not a linear function. The intensity produced by a monitor depends on the power factor of the voltage provided in it. This power factor is known as gamma. We can represent gamma while increasing the intensity of dark and low contrast image by:

$$I = V^{\gamma }$$
(1)

and while decreasing the intensity of bright and high contrast image by:

$$I = V^{1/\gamma }$$
(2)

where the voltage (V) drives the electron, flow is related to the light intensity (I) emitted by the monitor, and gamma (γ) is the power factor (constant). The representation of light intensity for various gamma (γ) value is demonstrated in Fig. 6.

Fig. 6
figure 6

Variation of light intensity for different gamma (γ) value

By gamma correction method [40, 41] we can correct the non-linearity function. The steps involved in gamma correction through a look-up table are given:

Step 1. Input image

Step 2. Determine the maximum pixel intensity

Step 3. Select the value of Gamma

Step 4. Look-Up table formation

Step 5. Mapping of input pixel in the Look-Up table

Step 6. Output Image

After determining the maximum intensity value from the input image, the crucial step is the look-up table formation and the selection of gamma value [42]. The formation of the look-up table for an 8-bit image frame is given below.

$${\text{Look-Up Table}} = \left| {{\text{Max\_intensity}} \times \left( {\frac{{[0:{\text{Max\_intensity}}]^{\gamma } }}{{{\text{Max\_intensity}}}}} \right)} \right|$$
(3)

Consider a sample frame where the highest intensity is 221, and the value of gamma (γ) applied is 0.5. So, the formation of the look-up table for each Index position will be:

$${\text{Look-Up Table}} = \left| {221 \times \left( {\frac{{[0:{\text{to}}:221]^{0.5} }}{221}} \right)} \right|$$
(4)

After the formation of the look-up table, input image pixels are mapped to the values in the look-up table. At the beginning, the first pixel of the image frame is considered and the intensity is calculated. At that time the corresponding look-up table index is checked. Finally, the matching value in the look-up table is collected to create a new image frame as demonstrated in Fig. 7. In this way, the region 2 (i.e.: headlight-glare portion) of all the frames are corrected one by one.

Fig. 7
figure 7

Mapping of image pixels to the values in look-up table

3.4.3 Low-light vision enhancement for region 3

In the case of night driving, region 3 of a frame contains a darker view of the road and the surrounding environment without any high-intensity beam and any headlight glare. Hence, the entire frame comes under region 3.

Some low-light image enhancement methods are introduced in recent years [43,44,45,46,47,48,49,50,51]. A Light invariant real-time recognition method is introduced which can detect hand gestures under various low-light conditions [52]. However, the low-light vision of region 3 is enhanced by maximum filtering grounded on the atmospheric light scattering model with a dynamic-patch and a dynamic atmospheric light for different states. This approach works effectively and provide an outstanding result for region 3 at night. In computer vision, the atmospheric light scattering model [53,54,55] is broadly used to define the formation of haze image by the given equation:

$$I(p) = J(p)t(p) + A(1 - t(p))$$
(5)

where (A) is the atmospheric light. I(p) is the desired intensity of pixel p. J(p) is the original light intensity of the object. t(p) describes the light emitted from the object. When the atmospheric light is similar, then the transmission map t(p) can be revealed as:

$$t(p) = e^{\beta d(p)}$$
(6)

where β is a coefficient of scattered (A), and d(p) is pixel p’s scene depth. In the same image, where β is constant, t(p) is determined by d(p), the distance between the object and the camera. For the image captured in a clear environment, β ≈ 0 and without considering its effect, we got I ≈ J. Similarly, when an image is captured in a low-light environment, then β > 0 and it turns into a non-negligible value. A frame is split into multiple small patches of size Ω. The low-light vision enhancement process aims to compute J from I with the help of A and t.

The local patch Ω(p) size is provided dynamically depending upon the intensity of the local pixels as follow:

$$\Omega (p) = \left\{ {\begin{array}{*{20}l} {3 \times 3\forall {\text{pixels where itensity}} \le 85} \hfill \\ {5 \times 5\forall {\text{ pixels where }}86 \le {\text{itensity}} \le 170} \hfill \\ {9 \times 9\forall {\text{pixels where itensity}} > 170} \hfill \\ \end{array} } \right.$$
(7)

In every patch at least one of the RGB values has the lowest value. The maximum filter is applied to every local patch of three RGB channels. The frame generated using this process has a very high intensity. The highest value of intensity Ihighest(p) of any pixel is estimated as follows:

$$I^{{{\text{highest}}}} (p) = \mathop {\max }\limits_{{y\varepsilon \{ \Omega (p)\} }} (\mathop {\max }\limits_{{c\varepsilon \{ r,g,b\} }} I^{c} (p))$$
(8)

Here, I is the input frame after fog removal, Ic is the color channel of I, Ihighest is the maximum intensity of I, and Ω(p) indicates the local dynamic-patch for the p location. The highest intensity is the result of two commutative max operators: \(\underset{c \epsilon \{r, g, b\}}{\mathrm{max}}\) is made on all the pixels and \(\underset{y \epsilon \{\Omega (p)\}}{\mathrm{max}}\) is the maximum filter.

The atmospheric light (A) is the average value of intensity in each color channel of RGB of the brightest 0.1% pixels (denoted as K) in the bright channel of I.

$$A = \frac{1}{\left| k \right|}\sum\limits_{p \in k} {I^{{{\text{highest}}}} (p)}$$
(9)

The source of atmospheric light (A) on the road is caused by streetlights and headlights. The road vision (frame) at night is classified into two states. a) Consist of headlights of forthcoming vehicles a) No headlights of any oncoming vehicles. Many real-time experiments are conducted and observed almost similar values for the same state. The value of (A) is calculated when a particular state starts and no need to calculate it until the change of the state and so on. Now, normalization of the Eq. (5) of a hazy frame is done as follows:

$$\frac{{I^{c} (p)}}{{A^{c} }} = t(p)\frac{{J^{c} (p)}}{{A^{c} }} + \left( {1 - t(p)} \right)$$
(10)

Afterward, the highest intensity is calculated by putting the max operator on each side of the Eq. (10):

$$\mathop {\max }\limits_{y \in \Omega (p)} \left( {\mathop {\max }\limits_{c} \frac{{I^{c} (p)}}{{A^{c} }}} \right) = t(p)\mathop {\max }\limits_{y \in \Omega (p)} \left( {\mathop {\max }\limits_{c} \frac{{J^{c} (p)}}{{A^{c} }}} \right) + (1 - t(p))$$
(11)

Here, t(p) is the transmission map. As J is a clear and bright output frame, so the highest intensity of J is tends to 255, i.e.:

$$J^{{{\text{highest}}}} (p) = \mathop {\max }\limits_{{y \in \{ \Omega (p)\} }} \left( {\mathop {\max }\limits_{c} J^{c} (p)} \right) = 255$$
(12)

Putting Eq. (12) into Eq. (11), we have

$$\frac{{I^{{{\text{highest}}}} (p)}}{{A^{c} }} = t(p)\frac{255}{{A^{c} }} + \left( {1 - t(p)} \right)$$
(13)

From Eq. (13) the transmission t(p) is assessed by

$$t(p) = \frac{{I^{{{\text{highest}}}} (p) - A^{c} }}{{255 - A^{c} }}$$
(14)

Sometimes t(p) becomes close to zero. Then, the output J(p) becomes a little bit noisy. To keep away from such a problem, t0 = 0.15 is finalized after several real-time experimental analyses. The ultimate scene radiance J(p) is recovered by

$$J(p) = \frac{I(p) - A}{{\max (t(p),t_{0} )}} + A$$
(15)

3.5 Adaptive gaussian filtering to smooth the boundary of regions

As different enhancement methods are applied in different regions, the pixel values on the boundary of different regions would not be smooth.

There are various filters available for smoothing and removing noise from images. Most widely used filtering methods are Beltrami Filter [56], Kuwahara Filter [56], Nonlocal Means Filter [57, 58], CLAHE with Rayleigh, uniform and exponential distributions [59], SUSAN Filter [56], Bilateral Filter [56, 60], Wavelet Denoising/ Thresholding [56], Wiener Filter [56], Anisotropic Diffusion Filter [61], Neural Network Filters [62], Adaptive Gaussian filter [63], etc. To remove the boundary spot line between the region 1, 2 and 3, most of the filtering methods are tested for the frames which are obtained after enhancement of three regions. It is observed that the Additive Gaussian Filter gives the best output for most of the frames with respect to smoothness and clearing of border spots in between the two regions.

Therefore, when the frame is segmented into three regions due to the presence of any oncoming vehicle, the adaptive Gaussian filter [63] is applied. It is applied only on the boundary and surrounding pixels (not to the whole frame) for smoothing the final output. Eight adjacent pixels in all directions of all boundary pixels are considered for filtering.

3.6 Video reconstruction and display

After the enhancement of three regions followed by adaptive Gaussian filtering, fresh video is reconstructed by arranging all frames in actual sequential order to display the real-time video. The real-time, fresh video is displayed on a 13-inch monitor with a maximum display resolution of 1920 × 1200. The monitor is installed just above the dashboard so that the driver can see the live real-time processed video during driving.

4 Experimental results

The proposed system is tested in different conditions during the night-time (such as presence and absence of high-beam headlights of oncoming vehicles). After many real-time testing, outstanding results for most of the frames are observed. The experimental results of this proposed approach for frames with high-intensity headlights of oncoming vehicles are shown in Fig. 8. Results for frames (real-time and from “BDD Dataset (BDD100K)” [64]) with no headlights (no oncoming vehicle) are shown in Fig. 9.

Fig. 8
figure 8

Experimental result of two frames (Frame 1: Frame with the high-intensity headlight of an oncoming bike in the evening, Frame 2: Frame with the high-intensity headlights of an oncoming car at night) by the proposed system. a Original frame b after enhancement of region 1 & 2 c obtained the highest intensity by dynamic-patch d transmission map e final output after low-light enhancement of region 3 and adaptive Gaussian filter

Fig. 9
figure 9

Low-light enhancement of frames (real-time frames and frames from “BDD Dataset (BDD100K)” [64]) with no high-beam headlight of any oncoming vehicle a original frame b obtained the highest intensity by dynamic-patch c transmission map d output frame

For assessment of the overall enhancement method, region-wise luminance of frames before and after enhancement are observed. To evaluate how well that glare can be removed, the luminance of regions 1,2 and 3 are calculated before and after enhancement. Luminance defines the measurement of light that is emitted, passed through, or reflected from any surface from a solid angle. It also specifies the amount of luminous intensity that can be perceived by the human eye, i.e. the amount of light that reaches the eye. The luminance of a pixel in a color frame is calculated as follows.

First, s(RGB) 8-bit integer value is converted to decimal 0.0–1.0 dividing by 255, i.e.

$$vR = \left\{ {\frac{s(R/G/B)}{{255}}} \right.$$
(16)

Then, RGB values are converted into linear values using “accurate” transform as follows.

$$V_{{{\text{linear}}}} = \left\{ {\begin{array}{*{20}c} {V^{^{\prime}} /12.29 \, V^{^{\prime}} \le 0.04045} \\ {\left( {\frac{{V^{^{\prime}} + 0.055}}{1.055}} \right)^{2.4} \, V^{^{\prime}} > 0.04045} \\ \end{array} } \right.$$
(17)

Finally, the luminance (L) is calculated as follows.

$$L = (0.2126 \times R_{{{\text{lin}}}} ) + (0.7152 \times G_{{{\text{lin}}}} ) + (0.0722 \times B_{{{\text{lin}}}} )$$
(18)

where L is the luminance and Rlin, Glin, and Blin are the normalized (linear) value of red, green, and blue components of the respective color [65, 66].

Few close observations of change of luminance value before and after enhancement are revealed in Table 1.

Table 1 Region wise luminance value before and after enhancement

In Table 1, it is observed that the luminance of regions 1 & 2 are reduced and the luminance of region 3 is increased for all the observations. Hence, it can be defined as satisfactory enhancement and it can also be called as “enhanced properly”.

Results of real-time experiments along with accuracy obtained by the proposed system are shown in Table 2. The proposed approach has also been trialed on “BDD Dataset (BDD100K)” [64] (contains plenty of night-time driving images). An outstanding result is observed on the dataset. The result obtained from the dataset is shown in Table 3, where “enhanced properly” indicates the enhancements of all the regions (1, 2, and 3) are satisfactory. Whereas “Unable to remove headlight glare” indicates all the headlights are detected, but the enhancement result is not satisfactory in terms of luminance (i.e. either the luminance of region 1 and region 2 is not reduced or luminance of region 3 is not increased).

Table 2 Real-time test results with accuracy
Table 3 Test result observed by the proposed method on the BDD dataset (BDD100K)

In Table 2 and Table 3, it is observed that all the frames with no oncoming vehicles are enhanced perfectly using the proposed approach. Most of the frames with the high-intensity headlight beam are also enhanced perfectly using the proposed approach. However, few frames are not enhanced properly because of the following reasons:

  • Rapid fluctuation of the atmospheric light (A) within the same state.

  • Regions are not segmented perfectly.

  • If a entire frame covered by region 1 and 2 (no region 3).

Few frames, which are not enhanced properly are shown in Fig. 10.

Fig. 10
figure 10

Frames, which are not enhanced properly a original frame b obtained highest intensity by dynamic-patch c transmission map d output frame

4.1 Processing time analysis

In the case of driving, the timing-factor is very vital. If a driver is unable to see the road at the same time as live then there will be a high chance of an accident. There should not be a big delay between live video acquisition and reconstructed video display. In this proposed system, the total processing of a frame is only a few milliseconds that a driver’s open eye will take to look like an original live video. The presented system is developed on a PC running Windows 10, on an i7 processor. A Logitech webcam is used to capture video. The camera is capable of capturing 30fps video with a maximum resolution of 1080 × 720 pixels in RGB format. Time taken (in milliseconds) by the entire process for various frame sizes, is exposed in Fig. 11. Time consumption of only the segmentation part is shown in Fig. 12.

Fig. 11
figure 11

Processing time observation (CPU Configuration: Intel(R) Core (TM) i7-10510U @ 2133 MHz, 8 GB RAM, and 500 GB SSD)

Fig. 12
figure 12

Segmentation time observation of various frame which contents a pair of headlight (CPU Configuration: Intel(R) Core (TM) i7-10510U @ 2133 MHz, 8 GB RAM, and 500 GB SSD)

Main strategies behind such a less processing time are as follows:

  • In region 3, the atmospheric light (A) is not calculated in every frame, it is calculated only when a new state starts.

  • The adaptive Gaussian filter is not applied to all the pixels of frames. It is applied only on two boundary areas (eight adjacent pixels of each boundary pixel in all directions) of three regions for smoothing the region borders. Smoothing is applied only if a frame consists of any high-beam headlight of an oncoming vehicle.

The compression of processing time among the proposed method and the existing methods, which reduces headlight intensity using image processing techniques for 1024 × 720 frame size, is shown in Fig. 13.

Fig. 13
figure 13

Compression of processing time among the proposed method with the existing image processing based headlight diming methods for a fixed frame size of 1024 × 720

4.2 Quantitative performance

As the ground truth of output frames are unknown, so no-reference (NR) methods are used to compare the objective quality-based assessment of our proposed approach with state-of-art techniques. No-reference free energy-based robust-metric for contrast-distortion (NIQMC) and blind image quality measure of enhanced images (BIQME) are used for effective assessment of performance [67, 68].

NIQMC evaluates the quality of an image by its local particulars and global histogram of the image. NIQMC particularly favors the images with higher contrast. Thus, higher NIQMC values indicate better image contrast quality.BIQME comprehensively considers five influencing factors, i.e., contrast, sharpness, brightness, colorfulness, and naturalness, and 17 associated features to blindly predict visual quality. A higher BIQME indicates better image quality.

We could not find any such existing approach that can reduce the headlight intensity of oncoming vehicles and improve road visibility at the same time. However, in existing approaches, researchers used various assessment techniques to compare their results and efficiencies to other low-light vision enhancement methods. There is no common assessment technique that is used by all researchers in a common platform for compression. Hence, it is not possible to compare the performance of the proposed method with existing approaches with the help of data available in the state-of-the-art methods. Therefore, to normalize the assessment and to compare the state-of-the-art methods with the proposed method, a common CPU and two common assessment techniques are used. The CPU configuration is Intel (R) Core (TM) i7-10510U @ 2133 MHz, 8 GB RAM, and 500 GB SSD, and the NIQMC and BIQME assessment methods are used to compare the efficiency of the proposed method with existing methods. The corresponding values of NIQMC and BIQME of the existing algorithms are recalculated along with the proposed method to make a significant compression. A comparative performance assessment (average of 10 output frames during the night) among existing methods in terms of NIQMC and BIQME is exposed in Fig. 14. Figure 14 reveals the performance superiority of our proposed technique compared to previously introduced low-light vision enhancement methods.

Fig. 14
figure 14

Quantitative performance assessment for the enhancement methods. a NIQMC. b BIQME

4.3 Comparative analysis with existing methods

There are few existing works which can control the headlight beam. But, most of them are used to reduce the headlight intensity of their own vehicles. Only a few methods are able to dim headlight beam of the other (oncoming) vehicle and unable to produce a prominent view of the road at night. However, a method wise comparison among the existing attempts is exposed in Table 4.

Table 4 Method wise comparison between the existing approaches

4.4 Limitation and discussion

The proposed system provides prominent output for maximum real-time frames at night. Yet, it has a few limits. The system yield noisy output in a few rare cases as follows:

  • If the headlight fluctuates unexpectedly within the same state, but atmospheric light is estimated previously.

  • If regions are not segmented perfectly.

  • If the glare of the headlights of oncoming vehicle spread in the entire frame and the road (region 3) is not visible.

Yet, these problems are temporary and happen rarely.

5 Conclusion and future works

The proposed real-time automotive night-vision system provides an enhanced view of the road by suppressing the high-beam headlight glare of oncoming vehicles. The driver won’t feel temporary blindness due to high-intensity headlight glare. The problem of enhancing the road view while dimming the headlights, which cannot be handled properly using night-vision spectacle glass or color coating windshield glass or any traditional night-vision systems, is smartly solved in the proposed system. It can dim headlight and can enhance the road view at the same time. Through this system, a driver can have a comfortable real-time vision in all conditions (i.e., presence or absence of high-intensity headlights of oncoming vehicles) during the night. The computation time, which is one of the most important criteria for driving has also been given due importance. Tests are conducted in different road conditions during the night and achieved an outstanding result with minimum processing time. This system can be installed in any vehicle which generally plies at night. The driver, as well as passengers, can be out of risk using this system. Pedestrians also can walk on the road safely if everybody uses the proposed system. The system can be used both in manual-driving vehicles and in autonomous vehicles. Road accidents throughout the night-time will also decrease.

In the future, the proposed work will be extended using smaller patch size in the darker region to handle rapid fluctuation of headlights. Multiple cameras may be used for better quality video acquisition and fast enhancement of regions through image fusion. Segmentation of regions from the frames can be done more accurately by employing noise-robust schemes. Quantitative and qualitative performance will be enhanced by grouping headlight beam according to intensity such as: very high, high, medium, low, etc.