Histogram Specification Question Is histogram equalization always good? 2/15/2023 2 No 2/15/2023 3 WHY ! 2/15/2023 4 Histogram Matching Histogram matching (histogram specification) — generate a processed image that has a specified histogram Let pr (r ) and pz ( z ) denote the continous probability density functions of the variables r and z. pz ( z ) is the specified probability density function. Let s be the random variable with the probability r s T ( r ) ( L 1) pr ( w) dw 0 Define a random variable z with the probability z G( z ) ( L 1) pz (t ) dt s 0 2/15/2023 5 Histogram Matching r s T (r ) ( L 1) pr ( w)dw 0 z G ( z ) ( L 1) pz (t )dt s 0 1 z G ( s) G 2/15/2023 1 T (r) 6 Histogram Matching: Procedure ► Obtain pr(r) from the input image and then obtain the values of s r s ( L 1) pr (w)dw 0 ► Use the specified PDF and obtain the transformation function G(z) z G( z) ( L 1) pz (t )dt s 0 ► Mapping from s to z z G 1 ( s) 2/15/2023 7 Example: Histogram Matching Suppose that a 3-bit image (L=8) of size 64 × 64 pixels (MN = 4096) has the intensity distribution shown in the following table (on the left). Get the histogram transformation function and make the output image with the specified histogram, listed in the table on the right. 2/15/2023 8 Example: Histogram Matching Obtain the scaled histogram-equalized values, s0 1, s1 3, s2 5, s3 6, s4 7, s5 7, s6 7, s7 7. Compute all the values of the transformation function G, 0 G ( z0 ) 7 pz ( z j ) 0.00 0 j 0 G ( z1 ) 0.00 G ( z3 ) 1.05 0 1 G ( z5 ) 4.55 5 G ( z7 ) 7.00 7 2/15/2023 G ( z2 ) 0.00 0 G ( z4 ) 2.45 2 G ( z6 ) 5.95 6 9 Example: Histogram Matching 2/15/2023 10 Example: Histogram Matching Obtain the scaled histogram-equalized values, s0 1, s1 3, s2 5, s3 6, s4 7, s5 7, s6 7, s7 7. Compute all the values of the transformation function G, 0 G ( z0 ) 7 pz ( z j ) 0.00 0 j 0 G ( z1 ) 0.00 G ( z3 ) 1.05 0 1 s0 G ( z5 ) 4.55 5 G ( z7 ) 7.00 7 2/15/2023 s2 G ( z2 ) 0.00 0 G ( z4 ) 2.45 2 s1 G ( z6 ) 5.95 6 s3 s4 s5 s6 s7 11 Example: Histogram Matching s0 1, s1 3, s2 5, s3 6, s4 7, s5 7, s6 7, s7 7. rk 2/15/2023 0 1 2 3 4 5 6 7 12 Example: Histogram Matching rk zq 03 1 4 25 36 47 57 67 77 2/15/2023 13 Example: Histogram Matching 2/15/2023 14