Skip to main content
. 2020 Apr 3;20(7):2007. doi: 10.3390/s20072007
Algorithm 1: The Pseudo-Code of Stitching Two Adjacent Images
Input: Adjacent images I1, I2;
The camera parameter of images camera1, camera2
1. Use camera1, camera2 to get the rough registration of two images f
2. Use S-H algorithm [34] and rough registration to get the overlapped area of the two images
3. Use SURF to extract feature points {pi} (i=1m) in the overlapped area on I1
4. Dived the overlapped area into n×n grids, and AreaFlagi FALSE (i=1,,n2)
5. Sort feature points, such that pi.response>pi+1.response (i=1,,m)
6. AnchorKeypointPairs{}
7. for pi in {pi}:
8. if (pi is in the kth grid) and (AreaFlagk=FALSE):
9.   pi is used as anchor point, its corresponding position: (u,v)f(pi.x,pi.y)
10.   let region R be the neighbor window around (u,v) on I2 with margin=3σ+pi.FeatureSize
11.   extract SURF features points in R {qj}(j=1l)
12.   for qj in {qj}:
13.   Δj=|pi.descriptorqj.descriptor|
14.   if Δmin<threshold:
15.    push pi,qmin into set AnchorKeypointPairs
16.    AreaFlagkTRUE
17.   if all the AreaFlag=TRUE:
18.   break
19. Solve transform matrix H with AnchorKeypointPairs
20. if |h11h22|>ε or |h12+h21|>ε (hij is the term of H):
21.  H use rough registration f(x,y) to calculate transform matrix
22. Use H to stitch the images to get the stitched image
Output: a stitched image I