Skip to main content
. 2024 Feb 16;10:e1810. doi: 10.7717/peerj-cs.1810

Algorithm 1. Generating sparse matches.

Input: I1, I2, a threshold ς
Output: a set M of sparse patch matches
1:   Divide the image I1 into a set of small regions {R1,R2,,RM}
2:  for each RiI1 do
3:   for any region PjI2 do
4:     set D(Ri,Pj)=BBS(Ri,Pj)
5:     set PM(Ri,Pj)={(ri,pj)|riRi,pjPj,S(ri,pj)=1}
6:   end for
7:  end for
8:  Determine the optimal matching set Mc={(Ri,Ri)|Ri=argmaxPjI2D(Ri,Pj)}
9:  for each (Ri,Ri)Mc do
10:  if BBS(Ri,Ri)>ς then
11:    M=MPM(Ri,Ri)
12:  end if
13:   end for