Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Spherical Image Stitching Based on ORB and PROSAC

Algorithm
Li Xin Liu Yarong Li Donghui
Guangxi key Laboratory of EmbeddedGuangxi key Laboratory of Embedded Guilin University of Technology
Technology and Intelligent System Technology and Intelligent System China 541004
Guilin University of Technology Guilin University of Technology
China 541004 China 541004
1996019@glut.edu.cn 2002048@glut.edu.cn 914490624@qq.com

Yang Liyan Yang Xiaofei Wang Yuchen


Guangxi key Laboratory of EmbeddedGuangxi key Laboratory of Embedded Guilin University of Technology
Technology and Intelligent System Technology and Intelligent System China 541004
Guilin University of Technology Guilin University of Technology
China 541004 China 541004
2014038@glut.edu.cn 2006016@glut.edu.cn 2846140310@qq.com

ABSTRACT 1. INTRODUCTION
This paper provides a real-time image stitching method. During To allow spherical camera users to take pictures with a viewing
stitching users often discover that panoramic picture is not ideal angle wider than the one supported by the mobile lens, researchers
because of the spherical camera taking the picture of wide-angle have proposed techniques for stitching multiple photographs or a
and large-area distortion. We presents the ORB algorithm stream of video into a single contiguous panoramic picture, or
extracting feature points, and PROSAC algorithm purification. panorama [1].
While traditional stitching researchers use the SIFT or SURF
method detecting feature points, and the RANSAC algorithm The traditional image mosaic use the SIFT and SURF detection
removes outpoints. We discover that SIFT and SURF algorithms feature points, combined with RANSAC algorithm excluding
require very complex calculations, and the RANSAC algorithm is points to increase the accuracy of matching feature point set[2].
equally and random for all feature point pairs, so the real-time However, these conventional methods require a lot of complex
processing is slow. In this paper, the use of ORB and non-random calculations, for higher real-time systems, these methods have a
PROSAC algorithm greatly shortens the running time. The certain degree of difficulty.
SURF+RANSAC and ORB+PROSAC algorithms are used to To solve the above problems, we proposes a method of using the
compare the stitching speed. Experiments show that the ORB and PROSAC panoramic image stitching algorithm which
ORB+PROSAC algorithm increase matching speed with better increasing the detecting and removing outer point speed of the
matching accuracy. feature point, shortening the time to the entire splicing process,
and using the fewer resources to achieve real-time process.
CCS Concepts
2. Algorithm
• Computing methodologies ➝ Computer graphics ➝
2.1 Longitude mapping method for spherical
Image manipulation➝Image Processing
image correction
Keywords Spherical coordinate positioning method, also called longitude
mapping method, is a typical fast two-dimensional fisheye image
image stitching; spherical image correction; ORB; PROSAC; correction algorithm.
As shown in Fig1, using the principle of spherical longitude
Permission to make digital or hard copies of all or part of this work for mapping[1], there should be these following steps :
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that
copies bear of this work owned by others than ACM must be honored.
Abstracting with credit is permitted. To copy otherwise, or republish, to
post on servers or to redistribute to lists, requires prior specific
permission and/or a fee. Request permissions from
Permissions@acm.org.
ICIIP '18, May 19–20, 2018, Guilin, China
© 2018 Association for Computing Machinery.
ACM ISBN 978-1-4503-6496-6/18/05…$15.00
https://doi.org/10.1145/3232116.3232142

160
xk xh 
 
dx R (3)

xh 2 2 
xk   R  Y
R 
Among them, R is the radius of the effective area of the spherical
camera, h is the abscissa of the original image (as an integer), and
Y is the ordinate of the k-point in the original image. Convert to
inverse mapping like xh:

Figure 1. image correction longitude module. xk  R


xh 
2.1.1 Model establishment of spherical coordinate R2  Y 2 (4)
positioning algorithm;
Each line in the graph is a common feature in the same meridian The inverse mapping finds the non-integer pixels in the original
point, after the correction, the correction of coordinates, with the image. Then, through the corresponding interpolation method, one
abscissa, the same as H, K of the two, although in the horizontal or more accurate points in the original image can be located.
and vertical coordinates of different, but in fact they are corrected Through the values of these points, the pixels after the correction
point horizontal coordinates are the same. The main principle of are obtained.
the model is: in the picture, Y take any vertical direction, or both
from the right and left spherical, the angle difference is consistent, 2.1.4 Description of spherical coordinate positioning
and the corresponding dx segment on the x axis uniform division algorithm
of warp, make different y on the x direction of the distance (1) Obtaining the image and process the two values. In this paper,
between the longitude is equal. the classical two-dimensional spherical coordinate positioning
method is used to deal with the spherical image, without the
2.1.2 Binaryzation of image and contour extraction; camera calibration and other related operations;
The binaryzation of the image is the process of turning a color
RGB image into a pure gray image. The steps of this algorithm (2) The radius and center of the effective region are obtained by
are: first step is setting the threshold and establish the using the scan line approximation method. After the two valued
corresponding scan loop. For the image of RGB system, gray image is scanned by the scanning line method, it can distinguish
scale transformation is needed, and the transformation formula is the effective area more clearly, and overcome the influence of the
as follows: edge black spot, and realize the similar effect with the region
growth method. If the valid area is detected as an ellipse, then the
I=0.59R+0.11G+0.3B (1) standard circle transformation of the ellipse is needed;
According to formula (1), the gray values of each point can be (3) After obtaining the radius and the center, the mapping relation
obtained, and then the gray value difference I can be obtained. from the target image to the original image is established. First, a
Once the value of I is found to be greater than the previously set square target image is determined by the radius, and the initial
threshold, the scan is considered to have entered the active region, pixel is set at 0.;
and the search in that direction will cease immediately.
(4) In pixels, coordinates are established in the target image and
At the end of the scan, the circumscribed square is obtained, and the original image, and inverse mapping is achieved according to
the center and radius formulas are calculated as follows: formula (4);

xI  xr  (5) Getting the relationship between the target image and the
x0  original image of the corresponding pixel;
2 

y  yb  (6) Obtaining the initial image correction.
y0  t (2)
2  2.1.5 Correction of image processing

x  xI  The model and algorithm of spherical coordinate orientation of
Rx  r spherical image distortion correction, image restoration of middle
2 
part of complete, but there are still some edge barrel distortion
yb  y1 
Ry   must, in order to obtain better correction effect of bilinear
2  interpolation of the image gray level after correction.

2.1.3 Solution of spherical coordinate positioning 2.1.6 experimental result


algorithm; In this paper, a spherical surface projection correction method and
As shown in Fig. 1, according to the line segment represented in a spherical coordinate positioning method are used to correct the
the diagram and the principle described in the preceding section, distortion of the same spherical image. The size of the image is
the following formula shall be applied: 300 * 400 pixel. The results are shown in figures 3 and 4. Figure 2
shows the distorted spherical image artwork. Fig 3 and Fig 4 show
the effect of distortion correction by spherical perspective
projection and spherical coordinate positioning.

161
matching feature point sets. However, these traditional methods
require a large number of complex operations. For systems with
high real-time requirements, these methods have certain
difficulties. ORB algorithm is combined by o-FAST Corner
Detection and BRIEF algorithm[5]. The algorithm uses Harris
corner detect feature. FAST defined as: If a pixel compare to its
surrounding neighborhood have a sufficient number of pixels in
different regions, the point may be corner.
As Figure 5, select a pixel P from the image, set the value X(P).
Compare this pixel to 16 pixles surrounding P. P as the circle
center, there are N consecutive pixels on the circle, the pixel value
either biggest than X(P)+T(T is threshold) or smallest than X(P)-T,
Figure 2. spherical image distortion then P is a corner. N is 9 or 12.

Figure 3. Spherical perspective projection correcting image Figure 5. FAST Corner detection .
o-FAST uses Rosin gray centroid, in which an image area defined
in a moment, where I (x, y) is value of point (x, y):

㌳䁠
䁠 ㌳ ㌳䁠晦 (5)
Obtained the centroid of image:
C=(Cx,Cy), , 䁠 (6)

In ORB, above image region is the neighborhood of FAST key


point, that is the key point of a circle, with three circular area
radius pixels. x, y in the range [3,3], that is, within the circular
area. This get a vector OC, OC represente direction of the FAST
key points, value of atan2 is the arctangent function range in (-n,
n), θ is key direction of the FAST.

θ=arctan(m01,m10) (7)

Figure 4. Longitude correcting image 2.2.2 the feature descriptors of ORB


ORB use improved BRIEF to description the feature points,
You can see from Figure 4, the middle region of the image rBRIEF. The algorithm use image smoothing before feature
correction of spherical coordinate positioning method is better, the described. The principle is to find a good match point from all
bilinear interpolation of the image gray scale correction after the corners detected by o-FAST algorithm to describe the
bending distortion curve edge also got a good correction. As characteristics of the image. ORB algorithm use the 256bits
shown in Figure 3, the spherical perspective projection method is descriptor, in order to obtain information BRIEF direction, you
not clear enough, and the loss of edge information is relatively first need to set the dot matrix form. For an n-bit set of test points
serious, while the spherical coordinate positioning method is more (xi,yi),defines a matrix of 2 × n:
detailed for the restoration of distorted scenes. Therefore, it can be
concluded that the spherical coordinate positioning model is better
than the spherical perspective projection model.
 x1 , x2 , xn 
S    (8)
2.2 Improving ORB algorithm  y1 , y2 , yn 
2.2.1 Feature point detection Depending on the direction angle obtained from FAST θ , find
The first step is feature detection based on ORB. In the traditional out its corresponding rotation matrix R θ , this get the set of the
image stitching technology, SIFT and SURF are mainly used for test which with the directional characteristics Sθ=RθS. ORB called
feature point detection [2, 3, 4], and the RANSAC algorithm is steered BRIEF, new descriptor can be expressed as:
used to remove the exclusion points to increase the accuracy of

162
g n ( p, )  f n ( p) | ( xi , yi )  S (9) (1) Each pair of data in the matching point set is sorted according
to the distance from the new point to the corresponding matching
Among them, p (x) is the average gray value of the image block p point after the matrix transformation;
at point (xi,yi). When the N test point is selected, finally the (2) According to the number of repeated sampling t, the size of
descriptor includes the main direction theta, the main direction the generation set n that matches the correct model point is
information to the descriptor. determined, and a sample set is formed by extracting 7 matching
points and the nth matching point from the top n of the ordered
2.2.3 feature point matching. matching point set;
After calculating the descriptors, feature points can be matched
by comparing the similarity of descriptors. The Hamming distance (3) Calculate the model parameters according to the sample set,
is used in the ORB to represent the similarity of descriptors. In calculate the distance from the new point to the corresponding
this experiment, the feature point rough matching is performed by matching point after the remaining matching points have been
using the ratio T between the nearest neighbor distance and the transformed by the model, and count the matching point logarithm
second nearest neighbor distance. When T is less than the X within the allowable error range;
threshold w (usually between 0.6 and 0.8), the feature point
corresponding to the nearest neighbor distance is considered to be (4) Repeat the above steps. When the ratio of the interior point
a rough matching point pair. reaches the maximum and is greater than the preset threshold T or
the number of interior points no longer increases, the
corresponding matching point pair set is the maximum interior
point set, and the final transformation matrix is calculated in the
interior point set.
To verify actual effect of this algorithm, test the purified
experiment with above two images, and count the operation
results. Precise matching effect as shown in Figure.5:
To count the purified time, using getTickCount( ),
(a) ORB rough matching .
getTickFrequency( ) to get times:
double t = getTickCount();
//start count time
… …;
// Required count time part

(b) SURF rough matching .


t=((double)getTickCount()-t)/

Figure 6. ORB and SURF Feature point matching . getTickFrequency();


The experiment use 960x720 images to ORB rough matching, //end count time cout<<"time:"<<t<<"s"<<endl;
results shown in Figure 6. In Table 1, we compare their times of
per thousand features, exist obviously mismatch match, we need //output the PROSAC running time
PROSAC algorithm to remove the mismatch features. In the experiment, the ORB+PROSAC and SURF+PROSAC
Table 1. ORB and SURF comparing algorithms were used to match the two original images in Figure 6,
and their matching speeds were compared. The results are shown
Thousand in the figure 7.
Match
Algorithm features Run time points
points
runtime
ORB 500 161 345.2ms 690.6ms

SURF 796 398 1726.48ms 2168ms

2.2.4 Using PROSAC algorithm to improve (a) PROSAC fine matching .


matching accuracy
The idea of PROSAC algorithm [6] is to first sort the correlation
between sampling points and models, then iterate according to the
sampling points with large correlation, and finally calculate the
model parameters based on the data of the interior points. The
number of interior points represents the model parameters, good
or bad. After repeated verification many times, until the number
of internal points no longer increases, the matching result is
optimal at this time. (b) RANSAC fine matching .
The algorithm is implemented as follows: Figure 7. 960x720 pixels image matching .

163
Comparing the above results of rough matching between ORB Figure 8. panoramic picture with two spherical images.
and SURF (Table 1), it can be clearly seen that some mismatching The experimental results show that by the processing of the
feature points are removed after several iterations of fine-match corrected fish-eye image, there is no obvious transition stitching at
iteration, and both algorithms have achieved very good removal the overlapping area, the brightness of both sides is basically the
effects ( As shown in Table 2 and Table 3), but the PROSAC same, thus achieving a smooth transition of the image pixels, the
algorithm has a significant speed advantage over the RANSAC experiment has been achieved better splicing effect. Since the
algorithm. right image is transformed using the transformation matrix H and
Table 2. ORB+PROSAC matching then stitched with the left image, the leftmost image of the spliced
image results. A black blank area appears on the side.
PROSAC feature Inner
Total time
time points points 3. Conclusion
350.668ms 5.327ms 100 80 In this paper, ORB feature extraction and PROSAC algorithm are
studied. ORB combines the oFAST operator and rBRIEF
descriptor to achieve rough matching of the image. The PROSAC
algorithm achieves the purification of matching feature points and
Table 3. SURF+RANSAC matching uses 960x720 pictures for experiments on ORB+PROSAC and
The SURF+RANSAC algorithm is compared to calculate the total
PROSAC feature Inner time of fine matching under 100 feature points, the time of
Total time
time points points purification algorithm and the number of internal points to
1774.85ms 48.365ms 100 92 evaluate the performance of the algorithm.
According to the description in [10], the speed of ORB algorithm
The RANSAC treats all sampling points equality, but PROSAC is 10 times that of SURF, and PROSAC is nearly an order of
sort model orrelation and sampling points first. Then iterate the magnitude faster than RANSAC algorithm speed. Then ORB
big correlation points, final calculate model parameters by inner combined with PROSAC algorithm can achieve faster image
point, more inner points represents high quality of the model stitching than SURF and RANSAC algorithm. Therefore, this
parameters. After replicated several times, until no increase in algorithm can achieve good real-time performance and can
inner point, then get a optimal model parameters. PROSAC guarantee the fluency of real-time splicing. It can be used for real-
assumes correct sampling points is more than error points [10], time splicing of images and videos.
that are inner points more than outer points. The ORB itself, the
inner points higher than the outer points, therefore PROSAC is 4. ACKNOWLEDGMENTS
very suitable. This research work was supported by Guangxi key Laboratory
Fund of Embedded Technology and Intelligent System ( Guilin
2.3 Image fusion University of Technology)under Grant No.2017-2-5.
Image fusion is to merge the registered images according to the
alignment position, and eliminate the color discontinuity and the 5. REFERENCES
influence of noise on the image. Commonly used fusion methods : [1] Xu Jincai, Wu Xukang. Spherical image correction method
Multi-resolution spline method [7]; Weighted average method [8]; based on spherical coordinate positioning algorithm [J].
Poisson fusion method [9]. The multi-resolution spline method is Computer disc software and application, 2014,17 (11): 129-
a color fusion method because it involves the structural problems 130. [2017-08-19].
of Costa and Laplace, which has the disadvantages of large
[2] Rublee E , Rabaud V,Strecha C , et al. ORB:an efficient
amount of calculation and time-consuming. The weighted average
method is relatively simple, but it can easily cause obvious alternative to SIFT or SURF[C]. Computer Vision(ICCV),
stitching seams. Poisson fusion is simple and convenient when 2011 IEEE International Conference on.IEEE, 2011:2564-
selecting fusion regions. Fusion uses the gradient field in the 2571.
source image block as a guide, and the difference between the [3] ZHANG Yajuan. Research on Image and Video Mosaic
source image and the target image on the fusion boundary is Technology Based on SURF Feature[D]. Xidian University,
smoothly diffused into the fused image block, making the fused 2013.
image block. Achieve a seamless effect when blended into the
[4] Li Qian, Jiang Zetao. Binary SIFT feature descriptors and
target image, and its hue and lighting are consistent with the target
image mosaic optimization [J]. Journal of Image and
image. Therefore, in this paper, the spliced image is smoothed by
Graphics, 2016, 21(12): 1593-1601
the progressive weighted average algorithm.
[5] Edward Rosten,Reidorter,TomDrummond. Faster and Better:
The camera product is Hikvision No.DS-2CD3942F-I. The fusion A Machine Learning App -roach to Corner Detection , 2010
images captured with two overlapping areas are shown in the IEEE Transactions on pattern analysis and machine
following figure 8. intelligence.
[6] TONG Ying, ZHANG Yan. Image Matching Algorithm
Based on Dual Detection Strategy Coupled with PROSAC
Technology[J]. Computer Engineering and Design, 2017,
38(11): 3137-3142..
[7] Wang Liangliang, Zhang Guicang, Jia Wenxiao. Medical
Image Fusion Method Based on Gradient Fusion Rule [J/OL].

164
Journal of Computer Applications, 2018(06):1-6[2018-01- BEMD[J]. Journal of Computer-Aided Design & Computer
05]. Graphics, 2017, 29(04): 607-615.
[8] Ying Tong, Jin Chen. Compressive sensing image fusion in [10] Jiang Pengfei. Video Image Mosaicing Based on ORB
heterogeneous sensor networks based on shearlet and Feature[D]. University of Electronic Science and
wavelet transform. EURASIP Journal on Wireless Technology, 2016.
Communications and Networking, 2017, Vol.2017 (1), pp.1- .
5.
[9] Hu Gang, Zheng Yuyue, Qin Xinqiang. Image Fusion
Method Combining Local Neighborhood Properties with C-

165

You might also like