Skip to main content
. 2021 Dec 14;23(12):1680. doi: 10.3390/e23121680
Algorithm 1: The training part of the soft compression algorithm for gray image.
  • Input:W images with size M×N

  • Output: The codebook for the shape layer and detail layer

  • Preprocess: predictive coding, negative-to-positive mapping and layer separation

  • forZ← 1 to W do do

  •    for matrx size (u,v)1×1tom×n, image coordinate (i,j)1×1toM×N do

  •      if IS[i,j:i+u,j+v] satisfies (48) and (49) then

  •         Get the shape S:=IS[i,j:i+u,j+v]

  •         if S in the codebook then

  •           Update the frequency of S in the codebook

  •         else

  •           Add S to the codebook

  •         end if

  •      end if

  •    end for

  •    Remove low-weight shapes based on frequency and size

  •    Count the distribution of pixel values in the detail layer ID

  • end for

  • Generate the codebooks