Skip to main content
. 2020 Oct 31;20(21):6217. doi: 10.3390/s20216217
Algorithm 1 Oversampling adjustment algorithm.
Input: Adaptive sampling: AS, Array of features of each block: F, Block size: NB, Number of blocks: TB
Output: Nonoversampled adaptive sampling: ASNOA
1: for each AS
2: if the sampling in AS is larger than NB
3: OS ← 0    //This variable is used to store the amount of oversampling among all blocks
4: NOSI [] ← empty //This variable stores the indices of nonoversampled blocks
5: for counter←1 to TB
6:  ifAS(counter)>NB
7:    OSValAS(counter)NB
8:    OS  OS + OSVal
9:    AS(counter)AS(counter)OSVal //Subtract the excess sampling from oversampled blocks
10:  Else
11:   NOSI [] ← counter    //Add counter to the array NOSI
12:  end if
13: end for
14: NOSF ← 0       //This variable stores the total feature values of nonoversampled blocks
15: for counter1 to count(NOSI)
16:   NOSFNOSF+F(NOSI(counter))
17   end for
18:   for counter 1 to count(NOSI)
19:     AS(NOSI(counter))AS(NOSI(counter))+((F(NOSI(counter))NOSF)×NOSF)
20:   end for
21: end if
22: end for
23: ASNOA AS