Skip to main content
. 2021 May 8;21(9):3263. doi: 10.3390/s21093263
Algorithm 1 Adaptive image scaling.
Input: W and H are the width and height of the input image.
          TW and TH are the width and height of the object image of standard size.
Begin
        scaling_ratiomin{TW/W,TH/H} 
        new_wW×scaling_ratio 
        new_hH×scaling_ratio 
        dwTWnew_w 
        dhTHnew_h 
        dmod(max(dw,dh),64) 
        paddingd/2
          if (W,H)(neww_,new_h):
            imageresize(input_image,(new_w,new_h)) 
        new_imageadd_border(image,(padding,padding))
End
Output: new_image