Skip to main content
. 2023 Jul 7;9(7):139. doi: 10.3390/jimaging9070139
Algorithm 1 Mapping from RGB color space to order space
  • Require: 

    a set of pixels {fi+k,j+l=[fi+k,j+lR,fi+k,j+lG,fi+k,j+lB]|(k,l)S}

  • Ensure: 

    a set of coordinates in order space {(oξR,oξG,oξB)|ξ{1,2,,|S|}}

  •  1:

    Assign serial numbers ξ{1,2,,|S|} to all pixels in the required set to have a set of re-indexed pixels {fξ=[fξR,fξG,fξB]|ξ{1,2,,|S|}}.

  •  2:

    for X{R,G,B} do

  •  3:

        [a1X,a2X,,a|S|X]=argsort(f1X,f2X,,f|S|X)

  •  4:

        for ξ{1,2,,|S|} do

  •  5:

            oaξXX=ξ

  •  6:

        end for

  •  7:

    end for

  •  8:

    Return {(oξR,oξG,oξB)|ξ{1,2,,|S|}}