Skip to main content
. 2024 Jun 13;24(12):3829. doi: 10.3390/s24123829
Algorithm 1 Pseudo-Code for Proposed Contrast Enhancement Method Using Region-Based Histogram Equalization with Dynamic Clipping Technique
Input: IIn: Input Image with N-bit format
Output: I(Out,L): Contrast Enhanced Output Image
  •   1:

    < Automatic Gain Control (AGC) >

  •   2:

    IIn.Max ← max(IIn)

  •   3:

    IIn.Min ← min(IIn)

  •   4:

    I8bits ← 255 × (IInIIn.Min) / (IIn.MaxIIn.Min)

  •   5:

     

  •   6:

    < Histogram Bin Calculation >

  •   7:

    for x1 to N do

  •   8:

       for y1 to M do

  •   9:

         H(I8bits)H(I8bits) + 1

  • 10:

       end for

  • 11:

    end for

  • 12:

     

  • 13:

    < Histogram Group Division >

  • 14:

    H1H(0:63)

  • 15:

    H2H(64:127)

  • 16:

    H3H(128:191)

  • 17:

    H4H(192:255)

  • 18:

     

  • 19:

    < Histogram Clipping >

  • 20:

    for L1 to 4 do

  • 21:

       HL.Max ← max(HL)

  • 22:

       HL.Min ← small(HL)

  • 23:

       [HL, EL] ← Clip(HL, HL.Max, HL.Min)

  • 24:

    end for

  • 25:

     

  • 36:

    < Excess Value Distribution >

  • 27:

    HC ← [H1, H2, H3, H4]

  • 28:

    EE1 + E2 + E3 + E4

  • 29:

    HCHC + (E / 256)

  • 30:

     

  • 31:

    < Output Value Mapping >

  • 32:

    C ← CDF(HC)

  • 33:

    P ← PDF(C)

  • 34:

    for x1 to N do

  • 35:

       for y1 to M do

  • 36:

         O(x,y) ← 255 × P(I8bits)

  • 37:

       end for

  • 38:

    end for