Rectangular Feature Recognition Method Based on Whale Algorithm
in Complex Background
Yingxiao Li
1
, Jia Liu
2
and Ping Ma
1
1
Control and Simulation Center, Harbin Institute of Technology, Harbin, Heilongjiang, China
1
Systems Engineering Research Institute, Beijing, China
Keywords: Feature Recognition, Complex Background, Multi-constraint Optimization Model, Whale Optimization
Algorithm
Abstract: Due to the complex background of the observation target, traditional feature extraction methods cannot
effectively acquire the target features. Based on the research of target recognition technology and its
engineering application, this paper proposes a target recognition method based on rectangular geometric
features. Firstly, a linear feature extraction method based on this condition is proposed, which is used to
identify the straight line on the edge of a rectangular object. Based on the Hough transform, the problem is
transformed into a multi-constraint optimization model, and the whale optimization algorithm is used to
solve the model to achieve accurate identification of features in complex backgrounds. The experimental
results show that the method can effectively detect the target features even if the number of lines in the
image varies greatly, which has better robustness and can improve the engineering execution efficiency.
1 INTRODUCTION
With the continuous development of computer
vision technology, people try to apply it to more
tasks. In recent years, feature recognition technology
has become more and more important in computer
vision technology, and it has played an increasingly
prominent role in various fields. In the aerospace
industry, scientists are trying to use feature
recognition technology to solve problems such as
space debris recovery and spacecraft on-orbit
services, such as the US abandoned satellite
recycling program "PHOENIX" (DARPA 2014), the
European Space Agency (ESA) Robotic
Geostationary Orbit Restorer program (Bischof et al.
2004),etc. in the field of industrial manufacturing,
part detection and processing technology based on
feature recognition technology is widely used
(Yuyuan et al. 2019) in the medical field, the
extraction of key information such as lesion area
also begins to rely on feature recognition technology
detection (Yuqing et al. 2008). In the Internet of
Things, quickly and accurately identifying packages
and accurately classifying them can greatly improve
their work efficiency (Zhongtai 2018). In summary,
identifying targets through spatial geometric
information of foreground targets is an important
issue in an unknown complex context.
At present, dealing with this problem in
engineering mainly involves two aspects, image
preprocessing and target recognition. In terms of
image preprocessing, the widely used processing
methods include multi-channel image grayscale,
quadrature equalization processing, denoising by
Gaussian filtering, etc., using some classical
operators to detect significant edges in the image.
Reference (Montague et al. 2005) built a visual
inspection system to measure the curvature of the
strip during hot rolling; Cheng Peng et al. (2013)
preprocessed the image in a specific context and
applied morphological theory to identify the circular
object; Another study (Wang et al. 2013) use the
Sobel vertical edge detection operator to identify and
locate the license plate for a license plate image
acquired in a complex background.
In terms of target recognition, Tokuhiro AT
(2005) used machine vision to detect the corrosion
of the control rod surface in the reactor; Amavasai
B. P. et al. (2005) added machine vision to the
micro-robot system, achieved the detection and
identification of the external environment; Singh V
et al. (2006) developed a machine vision-based
inspection system and classified metal sheets by
24
Li, Y., Liu, J. and Ma, P.
Rectangular Feature Recognition Method Based on Whale Algorithm in Complex Background.
DOI: 10.5220/0008096600240031
In Proceedings of the International Conference on Advances in Computer Technology, Information Science and Communications (CTISC 2019), pages 24-31
ISBN: 978-989-758-357-5
Copyright
c
2019 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
combining image processing with artificial neural
networks; Liu Y C et al. (2007) studied the
characteristics of laser fuze in complex environment,
and proposed a parallel artificial neural network
algorithm to detect and identify the edge features of
fuze.
Most current research on target recognition
focuses on target feature recognition for simple
backgrounds or specific contexts. These methods use
their own geometric feature constraints to extract the
target contour. The commonly used methods are
mainly iteration and enumeration. The main
disadvantage of this method is that its robustness is
not high and the computational efficiency is not
high. In some complex feature collection scenarios,
or real-time online processing projects, a more
efficient way to extract contours is needed. To solve
these kinds of complicated, large-scale optimization
problem, meta-heuristic optimization algorithms
emerged. By virtue of its obvious advantages,
mainly including easy to implement, do not require
specific parameters information and being able to
bypass local optima, these meta-heuristic
optimization algorithms have been utilized in
engineering applications widely.
Based on the previous research, this paper
proposes a target recognition method based on whale
optimization algorithm. In this paper, the geometric
features of rectangular objects of different scales are
used as features to be identified and tested in
complex backgrounds. At the same time, a multi-
constraint condition based on its spatial geometry is
proposed, which can extract the target contour
quickly and accurately after image preprocessing.
The simulation results show that the proposed
method can accurately extract rectangular targets
with complex background and has a certain degree
of robustness.
2 OBJECT STRUCTURE AND
FEATURE RECOGNITION
2.1 Rectangular Object Feature
Analysis
The main target of the proposed object in this paper
is Rectangular object. There are many rectangular
features in the identification problem that need to be
identified, such as satellites, parts, containers, etc.
There is no cooperation mark on it, and its motion
cannot be predicted. Therefore, its recognition
mainly depends on its geometric features. The
satellite body in Figure (a) has a rectangular feature,
Figure (b) is a rectangular component.
(a) Satellite (b) Rectangular component
Figure 1: Rectangular object structure.
2.2 Rectangular Feature Recognition
Process
In general, the feature recognition process in this
paper is mainly divided into two parts: image
preprocessing and line detection. In the process of
image shooting, it is easy to be affected by random
noise, weakening the morphological features of the
target, causing the target edge to be blurred, which
has adverse effects on image recognition. Therefore,
in order to facilitate the accuracy of image
recognition, it is necessary to perform a pre-
processing operation first, and then complete the line
detection on this basis.
2.2.1 Image Preprocessing
In this paper, the target is captured by a grayscale
camera. According to the acquisition equipment, the
image noise collected by this device is mainly
normal distributed noise. Denoising grayscale
images with Gaussian filter, which can eliminate the
interference caused by environment and equipment. .
The two-dimensional Gaussian distribution is as
follows:
22
2
2
2
1
( , )
2
xy
G x y e

(1)
Where
( , )xy
is the image coordinate and
is
the standard deviation. The Gaussian function is
discretized and combined with the original pixels to
obtain a Gaussian function value. This value is the
new pixel value in the current coordinates of the
image, and then the denoised image is obtained.
The first processing to be performed on the
denoised image is threshold segmentation, which
divides the object in the image from the partial
background to serve the edge detection of the object
to be measured. The threshold segmentation method
Rectangular Feature Recognition Method Based on Whale Algorithm in Complex Background
25
adopted in this paper is Otsu algorithm (Nobuyuki
Otsu 1979), which is a method for determining the
adaptive threshold. This method can maximize the
inter-class variance between the background and the
target, thus minimizing the probability of mis-
segmentation. It is a widely used fast image
segmentation method.
In terms of edge detection of images, a variety of
detection operators are widely used, and each
operator has its advantage. For example, the Reborts
operator uses local differences to find edges; the
Sobel operator combines direction difference
operations with local weighted averages to extract
edges; the Prewitt operator is similar to Sobel,
except that it uses first-meanization and then
differential. In this paper, the Canny operator is
used, which uses the variational method to find the
pixel boundary, and uses the double threshold to
segment the strong and weak edge points. This
operator is the theoretically relatively perfect edge
detection algorithm.
In this paper, the simulation experiment data is
collected by the gray scale camera. The Gaussian
filter denoising, adaptive threshold image
segmentation, edge detection and Hough transform
line extraction are used to identify the spatial
geometric features of the space. The specific process
of image preprocessing is shown in Figure 2.
Original
Image
Gaussian
Filtering
Adaptive
Threshold
Segmentation
Canny
Edge
Detection
Processed
Image
Figure 2 Image Preprocessing
2.2.2 Line detection based on Hough
Transform
The non-cooperative spacecraft body has a
rectangular geometric feature, and the spacecraft
body is identified by the preprocessed image. In this
paper, the Hough transform is used to extract the
linear features in the image, and then the rectangular
features of the spacecraft are obtained. The basic
idea of Hough transform is to transform the points in
the image space into the parameter space and
accumulate them by using the duality of the image
space and the parameter space, achieve the purpose
of detecting the line in the image space.
In two-dimensional space, the equation for a
straight line in a Cartesian coordinate system is:
y kx b
(2)
To avoid the case where the slope or intercept is
, convert the linear equation to the form under
parameter space
:
cos sinr x y


(3)
r
is the distance from the origin to the nearest
point on the line, and
is the angle between the x-
axis and the line connecting the origin and the
nearest point to it.
y
x
O
r
θ
Figure 3: Hough transform.
Figure 3 shows the principle of the Hough
transform, the points on the same line are converted
to the parameter space, and these points are
accumulated in the parameter space, so that the line
exceeding the target threshold is detected. However,
due to the complicated background, the selection of
the target threshold is very strict, and it is difficult to
accurately identify the target. Therefore, this paper
uses the whale optimization algorithm to screen
straight lines based on morphological constraints to
identify the correct target.
3 OPTIMIZATION MODEL
3.1 The Whale Optimization Algorithm
Whale Optimization Algortihm(WOA) is a novel
excellent meta-heuristic intelligence algorithm
proposed by Seyedali Mirjalili (2016), which is
inspired by the hunting rules of humpback whales.
WOA has been proved equipped prominent search
ability than most of the traditional intelligence
algorithm, such as Particle Swarm Optimization
(PSO) (Kennedy Eberhart 1995), gravitational
search algorithm (GSA) (Rashedi 2009), Differential
Evolution (DE) (Storn R Price K 1997.), et.al, since
it has the ability of avoiding in trapping in the local
optima and being able to converge to global optima
in a fast speed, and it is worth to be mentioned that
WOA has good performance in solving constrained
problems (Yuyuan 2019).
The primary rule of WOA is to update each
whale’ position towards the best solution up to now,
which is mainly composed by two parts, bubble-net
attacking method (exploitation phase), search for
CTISC 2019 - International Conference on Advances in Computer Technology, Information Science and Communications
26
prey (exploration phase).
1. Exploitation Phase (local search)
Here set the population size as NP and the
maximum iteration number as
max
T
.
The exploitation phase happens in most of the
situations, by updating the position to the best
solution.
*
*
( ) 0.5 1
( 1)
( ) cos(2 ) 0.5
bl
t A p and A
t
t e l p


XD
X
XD
(4)
where t means the iteration time currently, X is
the position vector,
X
represents the position of the
best individual so far and p is the random number
between 0 and 1.
The other parameters are calculated as follows:
**
( ) ( ), ( ) ( )C t t X t X t
D X X D
(5)
max
2
2 ( 1) ( 1,2,..., )
1
a - i- i T
N

(6)
(2 1), 2A a r C r
(7)
where r is the random number between 0 and 1, l
is the random number between 0 and 1and b is
constant, which influences the speed of convergence.
2. Exploration Phase (Global Search)
In this case, the position of the selected whale
updates towards a random individual, which aims to
avoid trapping in the local optima.
( 1) ( ) , 1 0.5
rand rand
X t X t A A and p D
(8)
( ) ( )
rand rand
=C X t X tD
(9)
where
()
rand
Xt
indicates the position of random
individual in the population, the other parameters is
obtained in the same way as exploitation phase
situation.
3.2 Mathematical Model
To build the mathematical model of the feature
recognition system, we transfer this problem into
finding two groups of parallel lines meeting the
requirement.
After the camera calibration, combined with the
calibration parameters and the size of the target, it is
known that the target size in the image is about
284 284
pixels, so
0
b
is set 284. Therefore, this
feature recognition problem is transferred into a
optimization problem, which is to screen out the
parallel lines which satisfy the distance requirement.
Then the selection mechanism in this paper is
concluded in Figure 4.
Figure 4: Selection Mechanism of WOA.
Considering the instrument precision, we choose
1
10 , 20kb
VV
in this paper.
In the end, determine whether the endpoints of
the real line segments on the parallel lines intersect
(allowing for some error), and finally select the two
sets of parallel lines of the target.
3.3 Experimental Flow Chart
Through the above modeling process, the flow chart
for the full experimental process is shown in the
Figure 5.
Start
Hough transform
detects straight
lines in pictures
Image
preprocessing
Parallel lines
selected
If it obtains all
parallels?
No
Yes
Output the
required lines
End
Intersect
Judgement
Figure 5: Algorithm Flowchart.
if
ij
k k kV
%Compare the gradient
between the two lines
if
0ij
b b b b b VV
%Compare distances
between two lines
Save lines i and j to the memory archive
end
end
Determine if the lines intersect in the range of the
errors permitted
Rectangular Feature Recognition Method Based on Whale Algorithm in Complex Background
27
For the mutual benefit and protection of Authors
and Publishers, it is necessary that Authors provide
formal written Consent to Publish and Transfer of
Copyright before publication of the Book. The
signed Consent ensures that the publisher has the
Authors authorization to publish the Contribution.
The copyright form is located on the authors
reserved area.
The form should be completed and signed by one
author on behalf of all the other authors.
4 EXPERIMENTAL RESULTS
AND ANALYSIS
In order to verify the feasibility of the rectangular
geometric feature recognition algorithm for non-
cooperative spacecraft, this paper builds a simulation
experiment environment and carries out
experimental verification. The experimental
environment consists of a high-resolution grayscale
vision module, a non-cooperative spacecraft model,
an image acquisition control and data processing
module, and an algorithm execution computer.
The camera used is a high-speed CMOS digital
monochrome camera from Mikrotron, Germany,
with a pixel resolution of
1680 1710
. The data
acquisition module consists of NI high-speed real-
time data collectors and storage devices. All
algorithms are coded in Matlab 2012a and
performed on a computer with Intel Core i7-8565
CPU,1.99 GHz and 8 GB RAM, under Windows 10
pro, 64-bit OS.
The above image acquisition device is used to
shooting the experimental image. The feature
detection algorithm proposed in this paper is used to
detect rectangular parts with different scales in the
Figure 6(a), Figure11 and Figure15.
Firstly, the detection process of a large-sized
rectangular object will be described. The large part
is made of KT board and reflective material. In this
paper, the size of the large part is
350 350
mm.
(a)Original Image (b) Processed Image
Figure 6: Image Preprocessing.
In order to verify the accuracy and robustness of
the algorithm, three different thresholds were chosen
to perform a Hough transform on the test image to
obtain a different number of straight lines, in this
way three experiments are solved in this section, the
thresholds set and the number of detected lines are
shown in table 1.
Table 1: Set of Experiments.
FillGap
MinLength
Lines number
1
100
350
21
2
120
200
84
3
120
80
133
For the above three images with different
numbers of lines, use the optimization algorithm
proposed in this paper for processing. The line
detection image and results after parallel
constraining optimization for the three experiments
are shown in the Figure 7, Figure 8, and Figure 9
separately.
(a) Line Detection (b) Parallel Obtained
Figure 7: Experiment One.
(a) Line Detection (b) Parallel Obtained
Figure 8: Experiment Two.
18
25
2
16
19
20
39
23
40
36
40
35
24
16
25
22
51
2
23
17
1
42
61
31
41
55
23
52
22
56
47
21
CTISC 2019 - International Conference on Advances in Computer Technology, Information Science and Communications
28
(a) Line Detection (b) Parallel Obtained
Figure 9: Experiment Three.
The search population of in WOA is set as 100,
and each experiment is repeated a 10000 times, then
the average iteration times, number of parallel
obtained and correct rate are recorded in Table 2.
Noted that the average iteration times means the best
result will not improve in 10 times iteration.
Table 2: Optimization Results.
Average
Iteration Times
Number
of Parallel
Correct
Rate (%)
1
11.4832
5
99.84
2
11.5543
12
99.99
3
11.7710
17
99.95
It can be concluded from Table 2 that the sets of
parallel lines obtained for these three tests are 5, 12,
and 17. Furthermore, with the increase of problem
complexity the average iteration times needed are
added slightly and the correct rate is fluctuate
between 99.99% and 99.84%, which means the
proposed method is feasible to solve this line
detection problem with strong adaptive capacity.
After parallel constraining selection by WOA,
most of the interference lines in the picture have
been filtered out. After performing the intersection
constraint, the three images get the same result, as
shown in the Figure10.
Figure 10: Final Recognition Result.
In order to verify the versatility of the algorithm,
other parts are identified by the above algorithm.
This time, this article uses color camera to collect
data. The same algorithm is used to identify a small
rectangular part(
55 55
mm)shows in Figure 11. As
shown in the Figure 12 and Figure 13, two sets
pictures are used in the experiments (Experiment
Four and Experiment Five), with different threshold
set.
Figure 11: Original Image.
(a) Line Detection (b) Parallel Obtained
Figure 12: Experiment Four.
(a) Line Detection (b) Parallel Obtained
Figure 13: Experiment Five.
Figure 14: Final Recognition Result.
It can be seen from the above output image that
53
29
73
3
32
86
15
47
33
31
21
22
20
34
55
32
75
29
81
97
74
88
41
42
65
64
53
78
4
1
2
14
15
3
2
17
4
1
12
3
29
37
38
36
Rectangular Feature Recognition Method Based on Whale Algorithm in Complex Background
29
the test image is identified by the algorithm
proposed in this paper, and the rectangular contour
of the object can still be detected in the case of more
interference, indicating that the algorithm has better
robustness; From the above point of view, the
optimization model proposed in this paper is highly
efficient and has better applicability.
Next, another figure with two rectangular parts is
test in this paper, and the original figure is shown in
Figure 15. The size of the part is
75 75
mm. Then
the result of this test (Experiment Six), including the
line detection figure and final recognition figure are
displayed in Figure 16.
Figure 15: Original Image.
(a) Line Detection (b) Final Recognition Result
Figure 16: Experiment Six.
5 CONCLUSIONS
Target recognition technology in complex
background is one of the key technologies at present.
For example, when performing part inspection and
recycling, it is necessary to accurately identify
targets with specific geometric features. This paper
presents a rectangular feature recognition method
based on whale optimization algorithm. There is no
need to exclude complex backgrounds during the
identification process. Once the target is successfully
identified, it can be used for subsequent tasks such
as pose measurement. After the image is pre-
processed, the Hough transform is applied to detect
the line, thereby extracting the line set to be
identified. Then, combined with the spatial
geometric feature constraints of the image, the
mathematical model is used to optimize and finally
identify the target object. The simulation experiment
proves that when the number of lines to be screened
in the picture is different, the optimization model
established in this paper can quickly and accurately
identify the rectangular features in the image, and
has high execution efficiency and strong robustness.
Moreover, this paper tests the image with multiple
rectangular features in the image. The results show
that the proposed algorithm can effectively extract
the features of similar rectangular objects in images.
ACKNOWLEDGEMENTS
This work was supported by the National Natural
Science Foundation of China under Grant number
61403096.
REFERENCES
DARPA Tactical Technology office, 2014. EB, Developing
Technologies for more Flexible, Cost effective
satellite operations in GEO, [online].
http://www.darpa.mil/Our_work/TTO/Programs/Phoe
nix.aspx.
Bischof B., Kerstein L., Starke J., 2004. ROGER-Robotic
geostationary orbit restorer. Science and Technology
Series. 2004. p183~193.
W Yuyuan, X Jie & J Weixi, 2019. Intelligent recognition
method for geometric features of parts based on
supervised machine learning. Computer Engineering
and Applications. 2019.
S Yuqing, C Jianmei, G Yizheng & W Chunhong.
Research on multi-feature medical image recognition
based on data fusion. Application Research of
Computers. Vol25. 2008. p1750~1752.
Z Zhongtai, 2018. Design and Key Technologies of Multi
AGV Logistics Sorting System. South China
University of Technology. 2018.
Montague R. J., Watton J., Brown K. J., 2005. A machine
Vision Measurement of Slab Camber in Hot Strip
Rolling. Journal of Materials Processing Technology.
Vol168. 2005. p172-180.
C Peng, 2013. Research on Circle Recognition under
Complex Background. Nanjing: Nanjing University.
2013.
Wang Y, Xu Q Y & Huang M M, 2013. On License Plate
Location in Complex Background based on Texture
and Colour. Computer Applications and Software. Vol
10. 2013. p259~262.
Tokuhiro A.T, Vadakattu S, 2005. Inspecting A Research
Reactor's Control Rod Surface for Pitting Using A
CTISC 2019 - International Conference on Advances in Computer Technology, Information Science and Communications
30
Machine vision. Journal of Nuclear Science and
Technology. Vol42. 2005. p994-1000.
Amavasai B. P., Caparrelli F., Selvan A., et al, 2005.
Machine Vision Methods for Autonomous Micro-
robotic Systems. Kybernetes. Vol34(9-10). 2005.
p1421-1439.
Singh V., Mishra R., 2006. Developing A Machine Vision
System for Spangle Classification Using Image
Processing and Artificial neural Network. Surface &
Coatings Technology. Vol201(6). 2006. p2813~2817.
Liu Y C. Fu Z, 2007. Target Image Identifying
Technology based on The Image Edge Characteristics.
Shanghai: Shanghai Jiao Tong University. 2007.
Nobuyuki Otsu. 1979. A Threshold Selection Method
from Gray-Level Histograms. IEEE Transactions on
Systems, Man, and Cybernetics. Vol9(1). 1979.
p62~66.
Seyedali Mirjalili, Andrew Lewis, 2016. The Whale
Optimization Algorithm.
Advances in Engineering
Software
. Vol95. 2016. p51-67.
Kennedy J, Eberhart R, 1995. Particle swarm optimization.
Proceedings of the 1995 IEEE international
conference on neural networks. 1995. p1942-1948.
Rashedi E, Nezamabadi-Pour H & Saryazdi S, 2009. a
gravitational search algorithm. Inf Sci. Vol179. 2009.
Storn R, Price K, 1997. Differential evolutiona simple
and efficient heuristic for global optimization over
continuous spaces. Glob Optim. Vol11. 1997. p341-59.
Rectangular Feature Recognition Method Based on Whale Algorithm in Complex Background
31