- freely available
Sensors 2014, 14(6), 10578-10597; doi:10.3390/s140610578
Abstract: Most railway accidents happen at railway crossings. Therefore, how to detect humans or objects present in the risk area of a railway crossing and thus prevent accidents are important tasks. In this paper, three strategies are used to detect the risk area of a railway crossing: (1) we use a terrain drop compensation (TDC) technique to solve the problem of the concavity of railway crossings; (2) we use a linear regression technique to predict the position and length of an object from image processing; (3) we have developed a novel strategy called calculating local maximum Y-coordinate object points (CLMYOP) to obtain the ground points of the object. In addition, image preprocessing is also applied to filter out the noise and successfully improve the object detection. From the experimental results, it is demonstrated that our scheme is an effective and corrective method for the detection of railway crossing risk areas.
Nowadays there are six kinds of railway crossings as classified by Taiwan Railroad Affairs: (1) the first kind of railway crossing has an isolator and alarm device, and it is watched by a workman; (2) the second kind of railway crossing has an isolator and alarm device, and it is watched by a workman on a regular schedule; (3) the third kind of the railway crossing has an isolator and alarm device, but it is not watched by anyone; (4) the fourth kind of the railway crossing is also called as a half-close type, and it is similar to type three. It only provides 1.5 m of space for pedestrians or motorcycles to pass; (5) the fifth kind of the railway crossing has an isolator and alarm device, and it is controlled by a human only when a train is passing; (6) the sixth kind of the railway crossing is a special purpose railway crossing. This kind of railway crossing is built for a particular company and therefore, it is controlled by that company.
In America, railway crossings are classified according to their traffic control facilities. There are two distinct types: one is an active crossing where all the facilities are controlled by the train's approach. Once the train is approaching, the system will enable all the alarm and facilities automatically. The other is a passive crossing: all the alarm systems and facilities are controlled by a human when a train is approaching. It offers the operator control of all the facilities when the train is approaching.
In pace with technology progress, several transport facilities have been improved. Lots of sensors used to detect the environment are now applied to transport facilities for people's safety. In the world, many active sensors are being developed for improving railway crossing safety; including induced coil, infrared, wide-band radar, and ultrasonic sensors. However, there still exist some problems, for example, dead angles in the detection, climate, the wind direction, interference with the environment.
Several authors have proposed lots of safety measures for railway crossings based on different sensor techniques. Sato  developed a method using ultrasound to detect an obstacle. Lohmeier  presented an obstacle-detecting method using a radar technique. Takeda  proposed a method for improving the signals of a railway crossing. Ku  designed a set of devices to show in meters how close the train is. Besides, many authors [5–11] have proposed methods for improving the safety of railway crossings using image detection techniques.
Han and Lee  presented the palm vein texture concept and applied a texture-based feature extraction method to achieve the palm vein authentication. In their algorithm, Gabor filters were used to achieve the optimized resolution in both the spatial and frequency domains. For obtaining an effective palm vascular pattern, they adopted a bit string by coding the palm vein features using an innovative and robust adaptive Gabor filter method. Meanwhile, two VeinCodes were measured by a normalized Hamming distance technique. Finally, they got highly accurate and rapid real-time palm vein recognition. From the simulation results, it is demonstrated that their method is feasible and effective in the palm vein recognition. Other methods [13–14] have been presented for the object detection by using image processing techniques.
In this research, we define that the risk area as the interval between the railway crossing gates. Further, we detect the railway crossing risk area by image processing techniques. Once humans intrude, the system will automatically emit an alarm and send a signal to the driver to stop the train. The remainder of this paper is organized as follows: Section 2 shows the related work. Section 3 shows the system algorithm. Section 4 describes the experimental results. Finally, Section 5 presents the conclusions of this paper.
2. Related Work
Measuring an object's distance and size in an image usually uses a linear regression technique because it is an easier and more effective computing method wherever the object is located. However, the ground of the object is located on is not always flat, so terrain drop compensation is necessary.
2.1. Linear Regression
Figure 1 shows the images which are used to construct a linear relation corresponding to the distance between the rod and camera. Since a curve makes it easier to show the linear relationship, we draw a curve using the test data as shown in Figure 2, where the X-coordinate denotes the length of the rod, and the Y-coordinate expresses the location of the bottom of the rod. From the figure we can clearly see that it is a linear relationship.
In this paper, we use the least square method to construct the linear regression and get the formula l = ap + b. The parameters are listed below:
2.2. Terrain Drop Calculation
Terrain drop is caused by the difference between the height of some point and the standard horizontal line. In the detection of a railway crossing's risk area, we need to calculate the terrain drop used as an offset for different uneven pavements. In this study case, the terrain drop is the object length difference in the image between the camera mounted on a horizontal line and the road. For calculating the terrain drop, several conditions of the camera need to be set. First we need to find out the drop level. It means that we measure an object height at a railway crossing and the flat ground, and then recode its difference as the offset of the terrain drop compensation. In this stage, we set the camera up under the same conditions such as the angle up or down, the focus of the camera, the same object, the same object length and at the same picture taking distance.
Figure 3 shows the object photography schematic diagram. Figure 3a displays the relationship between the object and camera which is mounted on flat ground. On the contrary, Figure 3b expresses the case where the object length in an image is captured by a camera mounted on the railway crossing, and it has a terrain drop problem. This case reveals the object is shrinking the length at the protruding pavement of the railway crossing. The terrain drop calculation formula is shown in Equation (6):
3. Risk Area Detection Algorithm
Most railway accidents happen in the railway crossing neighborhood; therefore it is called the risk area. This section describes the risk area detection algorithm. Figure 4 shows the flow chart of the railway crossing risk area detection. In the detection procedure, first, an image preprocessing stage is used to filter out the noise and some processing is performed for improving the gate extraction. Next, the railway crossing gates extraction stage is used to get the gates' position. Since the area of the vertical projection of the gates is the risk area, the gates must be extracted. Furthermore, since the railway crossing always has the terrain drop problem, terrain drop compensation (TDC) is needed to correct the measurements. After TDC, the system can obtain the real altitude of the gates from the gate length calculation by a linear equation. Finally, the gates and their altitude are obtained, and then the risk area is calculated. Besides, the background subtraction method is used to extract the objects. Since the small object size can be treated as noise, we discard the small objects to filter them out. Furthermore, the objects location calculation (OLC) is used to compute the real position of the objects standing on the ground in the picture. After the OLC operation, we compare the ground position of the objects with the risk area of railway by the existing risk objects detection (EROD). If the result of the EROD is true, an alarm will be issued. The details of the operation can be found in Figure 4.
3.1. Image Preprocessing
The image preprocessing stage is used to filter out the noise to improve the object detection. Figure 5 shows the flow chart of the image preprocessing of the risk area extraction. Since a binary image is suitable for object extraction, a binarization stage was used to convert the object image into a binary form.
The input image and background image were used to extract the object image using an image subtraction operation. In fact, railway crossing gates in Taiwan are red alternating with white. After trial-and-error methods, we discovered the white part is suitable for used in extracting the gates. Thus, a white part extraction stage is an important part of the process. Simultaneously, a binarization operation was used to convert the grayscale images R, G, and B into binary images, respectively. Then, the AND operation was used to combine the three binary images and obtain a hybrid binary image. Accordingly the hybrid image value is high; it can map and store the input image to obtain the candidate parts of the gates. After several operation stages, such as white color part extraction, area masking, rotate right operation, closing operation, and length filtering, we obtained the final output. Figure 6 shows the background subtraction results in the different RGB planes. Figure 6a is the result of the background subtraction in the R plane, Figure 6b denotes the result of the background subtraction in the G plane, and Figure 6c expresses the result of the background subtraction in the B plane. Finally, Figure 6d is the result after the summation and binarization of Figure 6b,c.
Since the red upper-part of the gates will be changed to white in the sunshine, we select the white part of the gates to avoid the interference. Besides, the HSV color planes are suitable for the extracted white part. A RGB to HSV transfer is used to complete the goal. In the paper, we set the thresholds S < 0.3 and V > 0.5 used as the conditions for extracting the white parts. The relative formula is given in Equation (7):
3.2. The Gates Extraction
Figure 7 shows the flow chart of the railway crossing gates extraction. In gates extraction, we develop a method called a white part associated with topology technique (WPAT) to detect the gate image parts. The gates image appears as several bar blocks like a dish bar after image preprocessing. In order to eliminate the dish bar appearance, first, we rotate right some of the bar block according to its length. Then the two images are summed; finally, the images before and after rotation are used to obtain a gate image without a dish. The result of this action generates an effect cascading the bar into a line. Figure 8 shows the railway gates extraction process. It shows the results of the block rotation right operation and cascading the gate rod as a line. Figure 8a is the background image, and Figure 8b is an input test image. Figure 8c shows the results of the white part extraction, and Figure 8d shows the results after filtering the noise. Figure 8e displays the results after white part rotation right of Figure 8d. Figure 8f displays the results after merging the images of Figure 8d,e. Successively, Figure 8g shows the results after dilation operation of Figure 8f,h shows the result after closing operation of Figure 8g. Finally, Figure 8i shows the result after lengthy fitting operations, it obviously cascades the white blocks as a line.
3.3. Terrain Drop Compensation
Since the railway maybe higher or lower than the nearby area, the railway crossing gates have the terrain drop problem. In order to solve the problem, terrain drop compensation (TDC) is used to improve the precision of the risk area calculation. In practice, the values of the TDC need to be obtained before the railway crossing risk area detection. Meanwhile, the data must come from the same camera image-grab conditions such as the angle up or down, the focus of the camera, the same test object and its length, and at the same distance to take a picture. From Equation (6) ltd = lg − lr, we know the terrain drop compensation is ltd, which needs to be obtained before starting the risk area detection, and lg and lr are the measured altitudes of the testing rod on flat ground and on the railway crossing under the same camera image-grab conditions. Besides, the length unit ‘cm’ and pixels conversion are also obtained.
In order to obtain the terrain drop value, a real datum by image test is executed. We set the test rod (100 cm) on the four corners: rear-left, rear-right, front-left, and front-right of the railway crossing gate, the TDC is calculated before the risk area detection. Figure 9 shows the measurement process of the terrain drop. Figure 9a is the test rod on rear-left, and Figure 9b is the extracted test rod image of Figure 9a. Similarly, Figure 9c, e and g are the test rod images on the rear-right, front-left and front-right, respectively. Figure 9d, f and h are the extracted length images of those test rods by the image processing, respectively. Actually, the risk area is the quadrilateral area of the vertical projection of the railway crossing gates. In the other words, the risk area is constructed by the test rod length of the four corner images, which are the ground points of the gate projection.
3.4. Risk Area Detection
The risk area of the railway crossing is a quadrilateral, so we need to compute the four corners of the railway crossing gates first. In the other words, we need four sets of offset data used to calculate the quadrilateral. Here we use a rod with 100 cm length to generate the offset data. Figure 9 shows the compensation data calculation method of the four corners. According to Figure 9, all the data obtained is shown in Table 1. The parameters in Table 1 are defined in the following: in the measured test rod altitude lr (cm) item, the parameters ‘a’, ‘b’, ‘c’ and ‘d’ are expressed as the measured altitudes of the rod on the left-rear, left-front, right-front and right-rear corners, respectively. In terrain the drop ltd item, the parameters ‘a’ , ‘b’, ‘c’, ‘d’ are expressed as the measured terrain drop of the rod positions on left-rear, left-front, right-front and right-rear, respectively. In the risk area RAS item, the parameters ‘a’ , ‘b’, ‘c’, ‘d’ are expressed as the measured segment length of the risk area from left-front point to left-rear point, from right-front point to right-rear point, from left-front point to right-front point and from left-rear point to right-rear point, respectively. Finally, in the errors errS item, the parameters ‘a’ , ‘b’, ‘c’, ‘d’ are expressed as the measured length difference of the risk area between the real measured and proposed calculated from left-front point to left-rear point, from right-front point to right-rear point, from left-front point to right-front point and from left-rear point to right-rear point, respectively.
In Table 1, where the extracted test rod length on left-rear is 84 cm, on left-front is 88 cm, on right-front is 92 cm, and on right-rear is 85 cm, respectively, where the corresponding terrain drops are 21 cm, 25 cm, −1 cm, and −20 cm. After a risk area is calculated, the coordinates of the risk area are 80 cm, 64 cm, 278 cm and 117 cm. When the real measurement is compared and predicted by our method, the error cm of the four corners are 1 cm, 9 cm, 26 cm and 3 cm. From the results; it is evident that our scheme is effective and precise. Figure 10 shows the test results, where the blue-line area denotes the calculated risk area in our method, and the red-line area express the real measured risk area. It is obvious that the two colored lines are very close, and it means the error is small.
3.5. Local Y-coordinate Maximum Points
We have developed a novel strategy called calculating the local maximum Y-coordinate object points (CLMYOP). Since the original point of the picture is located in the left-up position, the ground points of the object must be on the local maximum Y-coordinate points. According to the CLMYOP approach, we can easily obtain the ground points of the objects. Figure 11 shows the flowchart of the search for object ground points. For an object, its ground points must be the points where the Y-coordinate is a local maximum, therefore, canny edge detection can be used to get the edge of the object. We successfully extract all the local maximum Y-coordinate object points on the edge. Certainly, if the one of CLMYOP points is located on the range of the railway risk area, the system must issue an alarm.
4. Experimental Results
4.1. Environmental Conditions
Several (1920 × 1088) test images are used in our simulation to demonstrate the performance of the proposed scheme. As the hardware environment, we use a personal computer equipped with a INTEL(R) Core(TM) i5 CPU under a 3.1 GHz system clock, 8 Gigabyte memory, and an AMD Radeon™ display card. Besides, we use the Matlab R2012a as the program developing system.
In order to let the linear regression technique be used in this project, we did several tests as shown in Section 2.1. The results show that the distance ranges of the camera to the railway from 5 to 15 m are good, and the camera angles from 15° to −15° are suitable. However, the data was obtained with the camera placed at a height of 1.48 m.
On the other hand, the risk area RAf50 and its errors errf50 with the camera moving forward 50 cm, and the risk area RAb50 and its error errb50 when the camera is moved back 50 cm are important tests that can demonstrate the effectiveness of the scheme.
4.2. Experimental Results
In order to demonstrate our method is effective, several railway crossing images and real-stat measurements are used for simulations. Figure 12 is the gates extraction case-1, the railway crossing image is taken from the Doudile Road. Figure 12a shows the background image, and Figure 12b shows the input test image. Figure 12c shows the resulting image after extracting the white part and Figure 12d expresses the resulting image after filtering the noise. Figure 12e denotes the resulting image after rotating right the white part of Figure 12d, f denote the resulting image after merging Figure 12d,e. Finally, Figure 12g shows the resulting image after the dilation operation, Figure 12h shows the resulting image after the closing operation, and Figure 12i displays the resulting image after lengthy fitting operations. On the other hand, Figure 13 shows the terrain drop compensation measure steps of the railway crossing of Doudile Road. Figure 13a–d show the rear-left corner, the rear-right corner, the front-left corner and the front-right corner measuring situations, respectively. The measuring results of the terrain drop corresponding to Figure13 are listed in Table 2. The parameters a, b, c, and d of the Table 2, express the four corners: rear-left, rear-right, front-left and front-right, respectively.
From the results, we see the measured test rod altitudes (cm) of the four corners are 84, 108, 101 and 101. The terrain drops of the four corners are −4, −1, −16 and −13. The detected segment length RAS of the risk area from left-front point to left-rear point, from right-front point to right-rear point, from left-front point to right-front point and from left-rear point to right-rear point, are 107, 104, 352, and 220 cm respectively.
Similarly, the data RAf50, 113, 113, 378, and 224 are the same as the risk area data, and is obtained by moving the camera forward 50 cm, while the data RAb50, 97, 104, 311, 215 is the same as the risk area data, and represents the test results with the camera moving back 50 cm.
Figure 14 is the detection result of the risk area corresponding to case-1 (Doudile Road); the blue-line area is the detection result, and the red-line area expresses the real measured result. Figure 14a shows the measurement result with the camera mounted in the standard position. Figure 14b shows the measurement result with camera mounted 50 cm forward and Figure 14c shows the measurement result when the camera is mounted 50 cm backwards. If we carefully examine the simulation result and real measured result, we find the difference is little, and it means our scheme has high precision and only a little error.
Table 3 lists the measurement results of case-2, where we see the measured test rod altitudes (cm) of the four corners are 82, 93, 87 and 77. The terrain drops of the four corners are −11, −11, −6 and −13. The detected risk area RAS are 124, 97, 231, 211 cm. Similarly, the data RAf50 are 129, 111, 251, and 221, The data RAb50 are 111, 88, 210, and 204, the same as the risk area data, and these are the results of the camera moving back 50 cm.
On the other hand, Tables 4 and 5 show the test results of case-3 and case-4, respectively. They are similar to case-1 and case-2, and they all gave a high precision and low error. Table 6 lists the error data. The notations errS, errf50 and errb50 express the test errors of the risk area with the camera in the standard position, camera moving forward 50 cm and camera moving back 50 cm, respectively.
The parameters ‘a’ , ‘b’, ‘c’, ‘d’ are expressed as the measured length difference of the risk area between the real measured and proposed calculated distance from left-front point to left-rear point, from right-front point to right-rear point, from left-front point to right-front point and from left-rear point to right-rear point, respectively. From the above results, it is demonstrated that our scheme is an effective and simple method for railway crossing risk area detection.
Some test images including people were used to simulate the railway risk area detection. Figure 19 taken from NanSikon Road and Figure 20 taken from Danjan Road are the test images which include people in the railway risk area. Figure 19a shows the original image which is the people are in the railway risk area. Figure 19b shows the people extracted as an object in the picture. Figure 19c shows the edge image of the object. It is used to calculate the local Y-coordinate maximum for deciding the ground points of the object. Finally, Figure 19d shows the result of the railway risk area detection. Figure 20 is another test case; there are several people and a motorcycle rider in the test image. From the test results, we see have four objects O1, O2, O3 and O4 that are detected in Figure 20c. We check the local Y-coordinate maximum points p1, p2, p3 …p6, and we find that only p1 and p2 are in the risk area. This means only one person is in the risk area. This makes evident that our scheme can provide a correct detection even in a multi-people situation as shown in Figure 20d.
4.3. Function Comparison
In this section, we offer a tabular function comparison between Ku's  method and the proposed method. Table 7 shows the comparison results. As its main technique, Ku uses the wireless video communication technique to provide the train driver with a message about the railway crossing situation. On the contrary, our proposed method utilizes the image processing technique; it can automatically detect any intrusion in the risk area. For intrusion detection and preventing accidents, Ku's method depends on people, and it is manual work that easily causes mistakes. Besides, in the risk area error, Ku's method is dependent on people, making it different from the proposed method in that it is limited at 30 cm. As for the response, Ku's method takes less than 15 s and the proposed method is finished in 2 s. We conclude that our method and system can solve the problem automatically, and has high reliability when comparing with Ku's method.
In this research, we focus on detecting the risk area of railway crossings because most railway accidents happen on railway crossings. In our scheme, we develop a method called white part associated with topology technique (WPAT) to detect the railway crossing gates. Meanwhile, we use a terrain drop compensation (TDC) technique to solve the problem of the concavity of railway crossings. In addition the linear regression technique and image processing technique are used to achieve the goal.
From the simulation results, we obtain correct results when the terrains drop from +20 cm to −27 cm. At the same time, the detection results are also correct when the camera is moved forward 50 cm or moved backward 50 cm. The errors on the Chung-shin Road are 1, 9, 26 and 3 cm for segments a, b, c and d respectively. Similarly, the error data are 5, 11, 28, 11 for Doudile Road, 1, 8, 13, 10 for NanSikon Road, 7, 1, 30, 19 for NanPin Road, and 4, 3, 2, 2 for Danjan Road. It shows the error is limited to 30 cm. It is evident that our scheme is an effective and simple method for the railway crossing risk area detection.
This work was partly supported by the National Science Council, Taiwan (R.O.C.) under contract NSC 101-2221-E-167-034-MY2.
- Kazutoshi, S.; Arai, H.; Shimizu, T.; Takada, M. Obstruction detector using ultrasonic sensors for upgrading the safety of a level crossing. Proceedings of the International Conference on Developments in Mass Transit Systems, London, UK, 20–23 April 1998; pp. 190–195.
- Lohmeier, S.P.; Rajaraman, R.; Ramasami, V.C. Development of an Ultra-wideband Radar System for Vehicle Detection at Railway Crossings. Proceedings of the IEEE Conference on Ultra Wideband Systems and Technologies, Baltimore, MD, USA, 21–23 May 2002; pp. 207–211.
- Takeda, T. Improvement of Railroad Crossing Signals. Proceedings of 1999 IEEE/IEEJ/JSAI International Conference on Intelligent Transportation Systems, Tokyo, Japan, 5–8 October 1999; pp. 139–141.
- Ku, B.Y. Grade-Crossing Safety. IEEE Veh. Technol. Mag. 2010, 5, 75–81. [Google Scholar]
- Yaser, S.; Zhai, Y.; Shafique, K.; Shah, M. Visual Monitoring of Railroad Grade Crossing. Proceeding of Sensors, and Command, Control, Communications, and Intelligence (C3I) Technologies for Homeland Security and Homeland Defense III, Orlando, FL, USA, 12 April 2004; pp. 654–660.
- Kim, Z.W.; Cohn, T.E. Pseudoreal-time activity detection for railroad grade-crossing safety. IEEE Trans. Intell. Transp Syst. 2004, 5, 319–324. [Google Scholar]
- Cheng, S.C. Detection of Unstructured Road Boundary and Road Sign Recognition. M.Sc. Thesis, Univ. of National Chung Cheng, Chiayi, Taiwan, 1 July 2003. [Google Scholar]
- Shaposhnikov, D.G.; Podladchikova, L.N.; Golovan, A.V.; Shevtsova, N.A. Road sign recognition by single positioning of space-variant sensor window. Proceedings of the 15th International Conference on Vision Interface, Calgary, Canada, 27–29 May 2002.
- Vitabile, S.; Gentile, A.; Sorbello, F. A neural network based automatic road signs recognizer. Proceedings of the 2002 International Joint Conference on Neural Networks, Honolulu, HI, USA, 12–17 May 2002; pp. 2315–2320.
- Asakura, T.; Aoyagi, Y.; Hirose, K. Real-time recognition of road traffic sign in moving scene image using new image filter. Proceedings of the 26th Annual Confjerence of the IEEE Industrial Electronics Society (IECON 2000), Nagoya, Japan, 22 October 2000; pp. 2207–2212.
- Miura, J.; Kanda, T.; Shirai, Y. An active vision system for real-time traffic sign recognition. Proceedings of 2000 IEEE Intelligent Transportation Systems Conference, Dearborn, MI, USA, 1–3 October 2000.
- Han, W.Y.; Lee, J.C. Palm vein recognition using adaptive Gabor filter. Expert Syst. Appl. 2012, 39, 13225–13234. [Google Scholar]
- Romih, T.; Cucej, Z.; Planinsic, P. Wavelet Based Multiscale Edge Preserving Segmentation Algorithm for Object Recognition and Object Tracking. Proceedings of 2008 International Conference on Consumer Electronics Digest of Technical Papers, Las Vegas, NV, USA, 9–13 January 2008; pp. 1–2.
- Jia, D.; Huang, Q.; Tian, Y.; Gao, J.; Zhang, W. Hand Posture Extraction for Object Manipulation of a Humanoid Robot. Proceedings of the 2008 IEEE/ASME International Conference on Advanced Intelligent Mechatronics, Xi'an, China, 2–5 July 2008; pp. 1170–1175.
|errS of case-1||5||11||28||11|
|errf50 of case-1||1||7||18||1|
|errb50 of case-1||1||11||28||13|
|errS of case-2||1||8||13||10|
|errf50 of case-2||1||9||15||4|
|errb50 of case-2||7||11||10||10|
|errS of case-3||7||1||30||19|
|errf50 of case-3||1||2||15||18|
|errb50 of case-3||11||17||12||29|
|errS of case-4||4||3||2||2|
|errf50 of case-4||5||1||7||10|
|errb50 of case-4||6||5||18||7|
|Item||Ku  Method||Proposed Method|
|Main technique||Wireless video communication||Image processing|
|Identification decision||By people||Automatic identification|
|Intrusion detection||By people (manual work)||By System (Automatic)|
|Prevent accidents||By people (manual work)||By System (Automatic)|
|≤ 30 cm|
|Response time||≤ 15 s||≤ 2 s|
© 2014 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license ( http://creativecommons.org/licenses/by/3.0/).