Real-Time Image Processing Method Using
Real-Time Image Processing Method Using
47
B. Edge Detection corner detection algorithms and defines a corner to be a
Edge detection is an operation performed to detect point with low self-similarity [10].
borders that constrain two homogeneous imagery areas that There is more sophisticated corner detectors named after
have different brightness levels. The goal of edge detection their authors. Harris and Stephens algorithm is selected in
is to convert the 2D image into a curve shape. Edge is some detecting the corner of the line of road image. The Harris
part of the image where the intensity of the brightness and Stephens formula can be found in ref. [16], [17]. Harris
changes drastically. and Stephens Corner Detection is a corner detection
There are several methods in edge detection, among algorithm that is often used because it can produce a
them are Robert method, Prewitt method, Sobel method, and consistent value in the image that experiencing the rotation,
others. The method used in this experiment is the Sobel scaling, different light intensity conditions or have a lot of
method. The Sobel method has the ability to reduce noise noise in the image [8].
before performing edge detection calculations so that the
edge is generated more than before. This method uses two D. Traffic Light Detection
kernels of 3x3 pixels for the gradient calculation. To reduce the accident that happened at the traffic light
The gradient quantities calculated using a Sobel operator intersection, we develop Raspi camera based on algorithm
are as follows: which is real-time to detect red light of traffic light. We use
simple color extraction method. This is useful for
controlling the vehicle to stop if the red traffic light when it
G = Sx2 + S y2 (2) is turned on. The color detection of traffic light has been
studied previously in ref [18]. The original traffic light
image for red light detection can be seen in Fig. 5. In this
where method, we use the color threshold for converting the RGB
G is for = Gradient of Sobel Operator image to binary image. The threshold is selected based on
the red color. The proposed method will be tested in Fig. 5
Sx=Horizontal Sobel Gradient and the resulting image is presented in section III.
Sy=Vertical Sobel Gradient
G is also the gradient at the midpoint of the kernel and
the partial derivatives that are calculated using the following
equation as expressed in equation (3) and (4).
−1 0 1
S x = −2 0 2 (5) III. IMPLEMENTATION IN MATLAB/SIMULINK
−1 0 1 MATLAB is an interactive program for numerical
computation and data visualization. Simulink is a MATLAB
graphical extension to model and simulate a system. In
Simulink, the system is described as a block diagram,
−1 2 1
including transfer function, summing junction, in which
S y = −2 0 2 (6)
there are also virtual input and output devices. While in
−1 −2 −1 Simulink, data/information from various blocks sent to other
blocks connected with line. The user without programming
C. Corner Detection In this study, the image processing algorithms discussed
Corner detection is an approach used within computer in section III will be developed under MATLAB/Simulink
vision systems to extract certain kinds of features and infer environment. The image processing block uses Simulink
the contents of an image. Corner detection is frequently used Support Package for Raspberry Pi Hardware. it can be
in motion detection, image registration, video tracking, downloaded freely on the MathWorks web. For reading the
panorama stitching, 3D modeling and object recognition. image/video from Raspi camera, video capture block is
Moreover, corner detection algorithm is one of the earliest used. While the image processing algorithm uses Computer
48
Vision System Toolbox. detection used Raspberry Pi 2 Model B with Raspberry
Camera. The proposed methods from Fig. 6 to Fig. 9 are
The diagram block for line detection can be seen in Fig. embedded to Raspberry Pi single-board computer using
6. The image/video is captured using Video Capture block. Simulink Support Package for Raspberry Pi Hardware. The
The image is converted to intensity image using color space communication of host computer and Raspberry Pi is
conversion. It processed to edge detection using Sobel conducted by using ethernet connection. The selected pixel
operator and then it processed using Hough transform and is 640x480. The chosen frame per second (fps) in this
Hough line. research is 30 fps. This is the highest frame per second that
can be used in image/video processing using Raspberry Pi.
The line and traffic light detection are tested in indoor room
with fixed lighting.
A. Line Detection
Line detection of RGB image is conducted after the RGB
image is converted to an intensity image. The process of
converting the RGB image to intensity is conducted using
Color space conversion block. Intensity image can be
Fig. 6. Block diagram of line detection in the Simulink block diagram. represented as a single matrix. Each element of the matrix in
intensity image corresponding to one image pixel. The
For the corner detection, image/video is captured using resulted from line detection is shown in Fig. 10. Based on
Video Capture block. The captured image/video is the figure, it can find the right lane on the road image and
converted into an intensity image. The image then processed detect line on the right side of the road image. The detected
using corner detection method block using Harris & Stephen line is indicated with blue line. Based on the resulted image,
as shown in Fig. 7. For edge detection, image/video is the proposed method cannot detect dashed line and line
captured using Video Capture block. The captured having corner. It can detect perfectly on the continuous line.
image/video is converted into intensity image. The image
then processed by edge detection block using Sobel operator B. Edge Detection
as shown in Fig. 8. In red light detection, the algorithm uses The initial image for edge detection is RGB image. The
color selection using threshold. The threshold is selected image must be converted into an intensity image. The
based on the red color as shown in Fig. 9. resulted image from edge detection is shown in Fig. 11. The
edge detection using Sobel operator can detect the straight
double lines on the left side and right side, as well as dashed
line in the center of the road. The edge detection detects all
of the edges in Fig. 10 including the car model image.
49
V. CONCLUSION AND FUTURE RESEARCH
Based on the results in section IV, the line detection
method can be implemented for an autonomous car model
that use camera as vision sensor. The line detection will be
used in detection of road images when the road is straight
line. The Harris and Stephens corner detection can be
implemented for autonomous car model for detecting the
corner of the road. For edge detection, it is hard to
implement the method for an autonomous car because it will
detect all of the edges captured by camera. Red color
detection of traffic light still has the challenge to implement
it on the outdoor. Because the proposed method is not robust
Fig. 11. . Edge Detection by Sobel Operator. to the various lighting condition.
In future research, the corner detection will be enhanced
C. Corner Detection for estimating the angle of the line from o degree to 90
The performance of corner detection using the road image degrees. The traffic light detection will be improved using
can be depicted in Fig. 12. The Harris and Stephens corner pattern recognition method with neural network. The
detection can detect the left corner of the road image. The method will be tested under various lighting conditions.
detected left corner on the road image can be indicated with
a green mark as shown in Fig. 12. Based on the image, the
method can detect sharp corner with the angle of 90 degrees. ACKNOWLEDGMENT
The method can also detect the tip of the line road of the The authors gratefully acknowledge partial funding
image. support from the United States Agency International
Development (USAID) under the Sustainable Higher
Education Research (SHERA) program and research fund
from the Faculty of Engineering, Diponegoro University.
REFERENCES
50
[13] L. Kalms, J. Rettkowski, M. Hamme, and D. Göhringer, “Robust lane [17] Y. Xiao, Y. Wang, X. Dan, A. Huang, Y. Hu, and L. Yang, “Corner
recognition for autonomous driving,” in 2017 Conference on Design detection and sorting method based on improved Harris algorithm in
and Architectures for Signal and Image Processing (DASIP), 2017, pp. camera calibration,” presented at the Society of Photo-Optical
1–6. Instrumentation Engineers (SPIE) Conference Series, 2016, vol. 0023.
[14] Peter Corke, Robotics, Vision and Control - Fundamental Algorithms [18] T. H. P. Tran, C. C. Pham, T. P. Nguyen, T. T. Duong, and J. W. Jeon,
in MATLAB. Springer, 2011. “Real-time traffic light detection using color density,” in 2016 IEEE
[15] M. Malathi, and R. Geetha, “A Real Time Image Processing Based International Conference on Consumer Electronics-Asia (ICCE-Asia),
Fire Safety Intensive Automatic Assistance System using Raspberry 2016, pp. 1–4.
Pi,” Int. J. Mod. Trends Sci. Technol., vol. 2, pp. 34–38, 2016.
[16] C. Harris and M. Stephens, “A combined corner and edge detector,” in
In Proc. of Fourth Alvey Vision Conference, 1988, pp. 147–151.
51