Keywords

1 Introduction

In today’s world, traffic jams have become a really frantic activity due to uncontrolled growth in population. Every day, the number of cars on the road rises significantly. Fast transportation systems and rapid transit systems are important for the economic development of any nation. An in-depth study has been finished on the traffic control system and a big variety of articles and study papers have been posted on this subject matter for the last couple of decades. But most of the systems are inductive loop detectors, infrared and radar sensors which offer very limited traffic data and they’re a concern to excessive failure rate while installed on street surfaces. For road use and traffic management, automatic traffic monitoring and surveillance are important. Researchers have suggested several solutions to cope with this problem. There are some technologies which are in place to detect the traffic and control it.

1.1 Manual Control

In Manual Controlling of traffic, a Traffic Police is hired and allotted a particular area to handle the traffic congestion. They will control the traffic with the help of whistles and signboards. The disadvantage of this method is that it becomes difficult to handle heavy traffic and requires more manpower.

1.2 Automatic Control

Controlling Traffic Signals with the help of Timers and Electrical Sensors comes below Automatic Control. A mathematical value is sent into the timer at each segment of the traffic light for Timer Based Control. Based on the timer value, Traffic lights will operate in ON and OFF conditions. In the technique of the usage of electric sensors, the sensors will take a look at the availability of vehicles in a specific lane and will operate traffic lights between OFF and ON. The drawback of each of those techniques is that extra time is being wasted on an empty road. By regulating traffic lights with the aid of image processing, we can overcome those limitations.

1.3 Need for Image Processing

To technique, the hassle of Traffic congestion, Image Processing is a pleasant idea. The cars are detected through the System with the assistance of snapshots. By using image processing methods, these snapshots are processed. Here, the cars are detected through thinking about the captured snapshots as opposed to the usage of timers or digital sensors which can be located on the lane. A web camera is located on the site visitors mild which captures snapshots of the street via which the automobile matter is predicted and site visitors are controlled. Using picture processing in site visitors management is determined to be a higher method than the prevailing techniques. It allows lower site visitors congestion with no wastage of time because of displaying inexperienced indicators on an empty street with no cars. Nowadays it's also being utilized in automated site visitor tracking structures to manipulate the site visitors. The implementation of a picture processing is needed a set of rules in real-time site visitors mild management if we want to manage the traffic light efficiently [1,2,3,4,5]. The snapshots of the street on which we need to manipulate the traffic light will be recorded by a web camera positioned at every degree of a traffic lane. Then the captured snapshots have successively matched a reference image that is an empty street image with the use of image matching. The site visitors are ruled through the proportion of matching. The key factor of the paper is the method that is used for picture comparison. The authors have used picture matching strategies. A system that estimates the scale of site visitors on highways through the usage of picture processing and as a result, a message is proven to tell the number of motors on the highway. This venture has been carried out through the usage of the Matlab software program and its objectives to do away with heavy site visitors on highways [6,7,8,9,10]. A technique to cope with site visitors’ congestion, the usage of picture processing is shown in ref [3]. The video of a lane is recorded and extracted into frames. Then Image processing strategies are done at the captured body and the reference picture. Then the timer for the lane is allotted primarily based totally on the proportion of matching in each of the snapshots. The need for a sensible site visitor’s machine and the abnormal manner of implementation with embedded machine tools is shown in ref [4]. It is carried out the usage of item counting techniques and detection of emergency cars concurrently thereby managing the site visitors indicators primarily based totally on the concern outcome [11,12,13,14,15]. In [5] the idea of picture processing for the street site visitor management is shown. The system makes use of a canny area detection method for figuring out the density of the site visitors. Simulation results are used to demonstrate how the canny area detection strategy has greater effects on the estimation of site visitor parameters relative to other area detection strategies [16,17,18].

2 Proposed System Description

In today’s life, Traffic jams have become a main problem which we are facing in everyday life. The major cause is old technique is used in traffic light’ signals. We want an advanced technology and smart traffic control system to manipulate the traffic light in an efficient manner [19,20,21]. So This system proposed photograph processing based totally smart traffic control to manipulate the system to keep away from lengthy delays on-traffic’ lanes. This system is carried out in MATLAB 2018a software program via means of the usage of image processing techniques. A web camera is located on every degree of a traffic signal, a good way to capture images in a sequence.

First, the web camera will capture an image of an empty lane, a good way to be a reference photograph, and a real-time image of a traffic signal lane may be captured for matching with the reference image. After capturing pictures, the subsequent 4 steps to be followed:

  1. 1.

    RGB to Gray Conversion.

  2. 2.

    Resizing of an image.

  3. 3.

    Image Enhancement.

  4. 4.

    Edge Detection.

Then the images captured have successively combined the use of image with a reference photo that is an empty road image. The traffic is ruled consistent with the share of matching and time may be allotted on the idea of the above photo-matching results (Fig. 1).

Fig. 1
figure 1

Block diagram

3 Introduction to Image Processing

Image processing is a type of signal processing in which images or video images are the input. Each image and some of the capabilities or parameters relevant to the image may be the output of image processing. Many image processing techniques include the use of traditional signal processing techniques and the treatment of the image as a two-dimensional signal. Image processing is a way of enhancing raw images captured in ordinary life through cameras/sensors mounted on nearby probes, airplanes, and satellites or snap shots. A photo is a rectangular object with a photo. The processing of images presents photo rendering problems, compression techniques, and extreme problem operations that may be performed on the photo data. Image enhancement activities are the operations that come under image processing, which include blurring, brightening, enhancement of sections, etc.

3.1 Image Acquisition

In general, an image is a 2D f(x, y) function (where x and y are axes coordinates). The image's amplitude at a particular point implies that f is referred to as the image's intensity. At that point, it is also called the gray stage of the image. To form a digital image, we have to convert the x and y values to finite discrete values. The input image is a resource taken from the store database and the database of forces. To engineer it through a digital computer, it is essential to transform the analog image to a digital image. Each cell in a digital image has a finite value and that cell is known as a pixel (Fig. 2).

Fig. 2
figure 2

Input image

MATLAB Command for reading an image.

Imread (“original.png”).

3.2 Formation of Image

As the values of the images are proportional to the energy radiated with the aid of a physical source, we have a few conditions for creating an image f(x, y). So f(x, y) must be infinite and non-zero.

i.e., 0 < f(x, y) < ∞.

3.3 Image Resizing/Rescaling

In all digital images, image scaling happens in certain ranges, whether or not it is in Bayer demosaicing or photograph enlargement or no longer—the time you rescale an image graph from one pixel grid to another, this happens. When you want to increase or decrease the entire amount of pixels, image resizing is critical. Even if the same image graph is resized, depending on the algorithm, the end result will differ significantly. Because of some of the motives, photos are resized, but one in each of them may be very vital in our project. Each web camera has its preference, so while a system is built for a few digital camera specs, another digital camera relying on specification similarities will not operate successfully. So it's far more important to make the decision consistent for the software and for this reason carry out picture graph resizing (Figs. 3 and 4).

Fig. 3
figure 3

Original image

Fig. 4
figure 4

Resize/crop image

3.4 RGB to Grayscale Conversion

Humans understand radiation through wavelength-touchy sensory cells referred to as cones. There are 3 different kinds of cones, each of which has an extraordinary sensitivity to various wavelengths of electromagnetic radiation (light). One cone is especially susceptible to red, one to green, and one to blue light. We are able to produce almost any observable radiation by omitting a small mixture of those 3 colors (red, green, and blue) and stimulating the 3 types of cones at will for this purpose. The primary explanation why color photographs are routinely stored as 3 separate matrices of photographs; one matrix stores the amount of red (R) in each pixel, in another the amount of green (G) and the amount of blue (B) in third matrix. As saved in the RGB format, we call such color photographs. However, we no longer discern how often we emit different colors in grayscale images, we omit the equivalent amount in each channel. For each pixel, we might be in a position to discern the entire amount of light emitted; little light provides grayscale pixels and plenty of light is viewed as bright pixels. We don’t want to forget the RGB values for each pixel when converting an RGB picture to grayscale and make a single fee representing the brightness of that pixel as output. One of the way is by calculating the mean of each channel's i.e. (R + B + C)/3. However, the approach should take into account a weighted average, e.g.: 0.3R 0.59G 0.11B, since perceived brightness is routinely controlled by means of the green variable, an extraordinary, more “human-oriented” approach (Figs. 5 and 6).

Fig. 5
figure 5

Original image

Fig. 6
figure 6

RGB to gray

MATLAB Command for RGB conversion an image.

x = rgb2gray(“original.png”).

3.5 Image Enhancement

Image Enhancement is the method of improving digital snapshots in order to be more suitable for demonstration or additional study of the consequences. You might, for example, get rid of noise, so you can make it less difficult to choose the characteristics of the important thing. In bad snap shots assessment, the close characters merge while binarizing. We want to minimize the unfolding of the characters earlier than using the threshold of the picture of the word. We therefore implement “POWER-LAW TRANSFORMATION” so that the evaluation of the characters can be increased and greater segmentation can be permitted. The fundamental type of transformation of power-law is

$$S = c\gamma^{\gamma }$$

where r and S, respectively, are the input and output intensities; c and γ are non-negative constants (c not equal to zero). γ values map a small range of dark input values into a much broader range of output values. Conversely, this is also sufficient for better values of input levels. These also are known as gamma correction because of the exponent inside the strength power-law equation. In our experiment, the spectrum from 1 to 5 varies with gamma. If c is not equal to ‘1’ then scaling will alter the dynamic range of the pixel values remarkably. Therefore, after power-law transformation, we set the values of c = 1. To stay away from any other stage of rescaling. With γ = 1, if the transformed power-law image is passed via binarization, there may be no variance inside the give-up leading to simple binarization evaluation. If γ > 1, there may be a variant within the histogram graph, since there may be a boom of samples within the containers in the direction of zero gray expense. Gamma correction is important if an image is seen (Figs. 7 and 8).

Fig. 7
figure 7

Original image

Fig. 8
figure 8

Power-law transformation image

3.6 Edge Detection

Edge detection is the option for a difficult and rapid numerical method that recognizes elements in a virtual image in which the brightness of the photograph alter sharply or, in general, means that it has noise. In general, the elements where photographic brightness shifts clearly are properly prepared right into a hard and fast bent line segment called edges. The same difficulty of detecting noise within the 1 dimensional signal is referred to as phase detection, alternative detection is called the difficulty of identifying signal discontinuities over time. It was concluded that the Canny Edge Detector approach is the most powerful one after testing various edge detection algorithms. For our suggested prototype, we use the Canny as a Edge Detection method:

A. The Canny Edge Detector is known as the same set of rules for detection within the industry. As follows, the steps inside the Canny Edge Detector are

  1. 1.

    Smooth out the picture with a Gaussian dimension. The estimation of a dimensional Gaussian is expensive in maximum situations, so it is approximate in the approach manner of 1D Gaussians, one within the x-direction and the alternative y-direction.

  2. 2.

    Take the image's gradient. This illustrates pressure shifts, showing the presence of edges. This really provides results, with the gradient within the x-direction and the gradient within the y-direction.

  3. 3.

    Non-maximal suppression. Edges will emerge from variables in which it is necessary to suppress the gradient at most. The significance and direction of the gradient are computed at each pixel in order to do this. Then take a look at how the significance of the gradient is more distant from one pixel in either of the positive or negative directions perpendicular to the gradient for each pixel. If there is no more than one pixel, suppress it.

  4. 4.

    Edge Thresholding: The thresholding technique used by the Canny is called “hysteresis.” Each excessive threshold and a small threshold are used. If a pixel has a price higher than the excessive threshold, it can be taken as a pixel of the field. If a pixel has a price higher than the minimum threshold and is an area pixel's neighbor, it is also set as an area pixel. If a pixel has a price above the minimum threshold, but is not an area pixel neighbor. It cannot be set as a pixel of the field. If a pixel has a price below the low threshold, it is not set as a pixel region in any way (Figs. 9 and 10).

    Fig. 9
    figure 9

    Original image

    Fig. 10
    figure 10

    Edge detection

3.7 Image Matching

Recognition techniques primarily based totally on matching constitute every magnificence with the aid of using a prototype sample vector. The elegance closest to the predefined metric is assigned to an arbitrary pattern. The simplest technique is the least distance classifier, which, as its name suggests, measures the (Euclidean) distance of many of the unknown vectors and each of the prototype vectors. It selects the minimum distance in order to make a decision. There is an alternate method primarily based solely on similarities, which is very intuitive and can be formulated immediately in phrases of pictures. We have used a fully high-quality approach to image matching. Comparison of a reference image with a valuable pixel resource to a real-time image pixel. Although there are some hazards associated with fully matching pixel-based images, It is one of the first-rate techniques of the set of rules used in the choice-making venture. The real image is stored in the matrix in reminiscence, and the real-time image is also transformed within the chosen matrix. Their pixel values within the matrix need to be the same for the images to be identical. In pixel matching, this is the most important fact used. The counter used to calculate the vast type of pixel mismatch is provided at once whether there may be any mismatch in the pixel value. The number of matches is eventually expressed as

$$\% {\text{matching }} = \, \left( {{\text{No of pixels matched successfully}}/{\text{Total No of pixels}}} \right) \, * { 1}00$$

4 Implementation Algorithm

The following steps are part of the algorithm of this block diagram:

  1. 1.

    We have a reference image, and using a web camera mounted at the junction, the images to be matched are continually captured.

  2. 2.

    The pre-processing of the captured images is done according to the following steps:

    1. a.

      Images are resized to three hundred x three hundred pixels;

    2. b.

      The resized images are then transformed from RGB to gray.

  3. 3.

    The use of the canny side detection technique has been carried out by Edge detection of pre-processed images.

  4. 4.

    The output images of the previous phase matched the use of the technique of pixel to pixel matching.

  5. 5.

    Every reference and real-time image are matched after the edge detection phase, and traffic lights can be managed based more on a percentage of matching (Fig. 11).

    Fig. 11
    figure 11

    Time allocation table

5 Experimental Results

Experiments are completed and rely on the traffic density on the road, from which we obtain the following result concerning the time allocation of numerous traffic lights.

Figure 12 shows the empty lane image which is a reference image for comparison between different lanes. Figure 13 shows the real-time capture image of traffic which will be compared with the reference image of the lane.

Fig. 12
figure 12

Reference image

Fig. 13
figure 13

Capture image

Figure 14 shows the result of various methods involved in image processing. It shows a comparison between captured reference and real time captured images in which the original image is converted to gray scale images which is followed by image enhancement an edge detection.

Fig. 14
figure 14

Output of edge detection technique

Figure 15 shows the result of percentage match on the basis of which time will be allocated for different lanes.

Fig. 15
figure 15

Percentage match of the reference image and captured image

6 Conclusion

“Image Processing Based Smart Traffic Control for Smart City” is the technique that we have approached that minimizes all the constraints of the previous techniques implemented for reduction in traffic congestion. In Automatic traffic which uses a fixed time-based technique in which time is wasted on empty roads also. The Image processing technique eliminates the issue of the existing system. It was observed that the Canny Edge detection technique gave a better result. This chapter suggests that image processing is a greater green technique for traffic control systems in comparison to conventional techniques. The use of this technique gets rid of the want for added hardware which includes sound sensors and loop detectors. This will remove the excess time wasted in the traditional traffic system. The main advantage is the variation of signal time which is allocated based on traffic density with the help of image match percentage. The exactness within side the time allocation depends upon the position even as going through the street each time.

7 Future Work

The main focus will be to implement emergency vehicle detection and emergency situations like accidents in which control will be given to traffic police. Also, the Foggy weather condition situation also will be taken under consideration to capture clear images under foggy weather. For real-time practical situations, the execution is done through hardware implementation.