Skip to main content
. 2019 May 28;19(11):2439. doi: 10.3390/s19112439
Algorithm 2 Localized sequence matching and visual localization.
Inputs:
 {D} {Cosine distance};
 Ntrain,Ntest {training and testing images numbers};
 Vmax,Vmin {maximum and minimum speed ratios};
 Vstep {Vehicle speed step-size}
 ds {Sequence length};
Outputs:
 S {Path-line (sequence candidate) score};
 for T ← ds to Ntest do
  MT ← [DT−ds+1,DT−ds+2,⋯,DT]; // Local searching matrix.
  j ← 1; // Path number (sequence candidates number) initialization.
  for s ← 0 to (Ntrain−Vmax×ds) do
   for V ← Vmin: Vstep: Vmax do
    ST,j ← 0;
    for t ← (T−ds+1) to T do
     k(t)←s+V(t−(T−ds+1)); // k is a line index in the column vector Dt; s is the training image number where the path originated in.
     ST,j ← ST,j+Dk(t)t; // Score S is calculated for each possible path.
    end for
    j ← j+1; Sequence candidate number updating.
   end for
  end for
  SST=minj{ST,j}minj(j≠m1){ST,j}; m1 is the index of minimum score.
  if SST<=Th
  Matching validation is positive;
  Vehicle position ← The matched training image position
  if SST>Th
  Matching validation is negative;
  Vehicle position ← NaN (no position results)
 end for