@@ -17,7 +17,7 @@ public class HistogramEqualizationTests
1717 [ Theory ]
1818 [ InlineData ( 256 ) ]
1919 [ InlineData ( 65536 ) ]
20- public void HistogramEqualizationTest ( int luminanceLevels )
20+ public void GlobalHistogramEqualization_WithDifferentLumanceLevels ( int luminanceLevels )
2121 {
2222 // Arrange
2323 var pixels = new byte [ ]
@@ -45,20 +45,21 @@ public void HistogramEqualizationTest(int luminanceLevels)
4545
4646 var expected = new byte [ ]
4747 {
48- 0 , 12 , 53 , 32 , 146 , 53 , 174 , 53 ,
49- 57 , 32 , 12 , 227 , 219 , 202 , 32 , 154 ,
50- 65 , 85 , 93 , 239 , 251 , 227 , 65 , 158 ,
51- 73 , 146 , 146 , 247 , 255 , 235 , 154 , 130 ,
52- 97 , 166 , 117 , 231 , 243 , 210 , 117 , 117 ,
53- 117 , 190 , 36 , 190 , 178 , 93 , 20 , 170 ,
54- 130 , 202 , 73 , 20 , 12 , 53 , 85 , 194 ,
55- 146 , 206 , 130 , 117 , 85 , 166 , 182 , 215
48+ 0 , 12 , 53 , 32 , 146 , 53 , 174 , 53 ,
49+ 57 , 32 , 12 , 227 , 219 , 202 , 32 , 154 ,
50+ 65 , 85 , 93 , 239 , 251 , 227 , 65 , 158 ,
51+ 73 , 146 , 146 , 247 , 255 , 235 , 154 , 130 ,
52+ 97 , 166 , 117 , 231 , 243 , 210 , 117 , 117 ,
53+ 117 , 190 , 36 , 190 , 178 , 93 , 20 , 170 ,
54+ 130 , 202 , 73 , 20 , 12 , 53 , 85 , 194 ,
55+ 146 , 206 , 130 , 117 , 85 , 166 , 182 , 215
5656 } ;
5757
5858 // Act
5959 image . Mutate ( x => x . HistogramEqualization ( new HistogramEqualizationOptions
6060 {
61- LuminanceLevels = luminanceLevels
61+ LuminanceLevels = luminanceLevels ,
62+ Method = HistogramEqualizationMethod . Global
6263 } ) ) ;
6364
6465 // Assert
@@ -75,6 +76,24 @@ public void HistogramEqualizationTest(int luminanceLevels)
7576 }
7677 }
7778
79+ [ Theory ]
80+ [ WithFile ( TestImages . Jpeg . Baseline . HistogramEqImage , PixelTypes . Rgba32 ) ]
81+ public void GlobalHistogramEqualization_CompareToReferenceOutput < TPixel > ( TestImageProvider < TPixel > provider )
82+ where TPixel : unmanaged, IPixel < TPixel >
83+ {
84+ using ( Image < TPixel > image = provider . GetImage ( ) )
85+ {
86+ var options = new HistogramEqualizationOptions
87+ {
88+ Method = HistogramEqualizationMethod . Global ,
89+ LuminanceLevels = 256 ,
90+ } ;
91+ image . Mutate ( x => x . HistogramEqualization ( options ) ) ;
92+ image . DebugSave ( provider ) ;
93+ image . CompareToReferenceOutput ( ValidatorComparer , provider , extension : "png" ) ;
94+ }
95+ }
96+
7897 [ Theory ]
7998 [ WithFile ( TestImages . Jpeg . Baseline . LowContrast , PixelTypes . Rgba32 ) ]
8099 public void Adaptive_SlidingWindow_15Tiles_WithClipping < TPixel > ( TestImageProvider < TPixel > provider )
0 commit comments