Skip to main content
. 2024 Jul 1;14(13):1402. doi: 10.3390/diagnostics14131402
Algorithm 2 Reinhard Color Normalization
  • Input: 

    Source image Is in RGB, Target image It in RGB

  • Output: 

    Normalized source image Is in RGB

  •   1:

    Convert Is from RGB to Lab color space to get Ls,as,bs

  •   2:

    Convert It from RGB to Lab color space to get Lt,at,bt

  •   3:

    Compute mean μLs, μas, μbs and standard deviation σLs, σas, σbs of Is

  •   4:

    Compute mean μLt, μat, μbt and standard deviation σLt, σat, σbt of It

  •   5:

    for each channel C{L,a,b} do

  •   6:

        Subtract mean from source: CsCsμCs

  •   7:

        Scale by standard deviation ratio: CsCs×(σCt/σCs)

  •   8:

        Add target mean: CsCs+μCt

  •   9:

    end for

  • 10:

    Merge normalized channels to get Lab image Is{Ls,as,bs}

  • 11:

    Convert Is from Lab to RGB color space