Talk:Histogram equalization

message: I have created an example.  But it seems a little awkwardly placed.  Feel free to re-arrange it or put it in a different location in the article.--Konstable 05:56, 11 June 2006 (UTC)
replies: text: Excellent! I love the example. Wilson Harron 21:55, 22 October 2006 (UTC)
replies: text: Thanks!--Konst.ableTalk 22:45, 22 October 2006 (UTC)
thread_title:  Example added 

message: Added a section on back project with a citation and footnote reference, but couldn't figure out how to get the superscript to link properly. kostmo 20:40, 18 August 2006 (UTC)
thread_title:  Superscript link 

message: Sorry, but I don't understand why is this page into philosophy's project. It seems better suited to optics, computer science or something like this, is not?--Patillotes (talk) 07:47, 31 January 2008 (UTC)
thread_title:  Philosophy project 

message: The formula in the example is not correct: it says "cdf(v) = round[cdf(v)..." when it should be something like "vnew(vold) = round[cdf(vold)...", as the formula gives us the new value that a certain gray level in the original image will assume in the equalized image. Gazilion (talk) 12:10, 12 March 2009 (UTC)
thread_title:  Error in formula 

message: Maybe it makes sense to mention Histogram Matching (match histogram to a distribution of a 2nd source). Even more important is Histogram Equalization in log-log-domain (Histogram Hyperbolization). Hyperbolization is achieved by using the power function for the cdf. This leads to more "natural" results, since many quantities in nature are roughly linear in log-log domain (including light as perceived by the human visual system). -- 92.225.71.216 (talk) 09:50, 30 November 2009 (UTC)
thread_title:  Histogram Matching and Histogram Hyperbolization 

message: The overview is not an overview if it starts giving mathematical jargon and talks about DNA stuff. Applications of this technique shouldn't be discussed in that much detail. There are also a few grammatical mistakes in the overview. The discussion of when the equalization should be used is also simplifying it too much. The section is just bad; the main person to blame is whoever added that stuff about DNA.Owen214 (talk) 04:38, 13 June 2010 (UTC)
thread_title:  Overview is bad 

message: This article talks about the equalization being invertible, yet the german wikipedia (and my image processing course notes) say that is is explicitly NOT invertible. Which also makes sense to me, since this process can map multiple (infrequent) grey levels in the source image to the same grey level in the resulting image.
--77.176.232.123 (talk) 21:04, 20 December 2010 (UTC)
thread_title:  Invertible? 

message: The formula for histogram equalization icludes CDF values(Commulative Distribution Function) which are probabilities.
So, when the formula 
h(v) =
 \mathrm{round}
 \left(
   \frac {cdf(v) - cdf_{min}} {(M \times N) - cdf_{min}}
   \times (L - 1)
 \right)
mentions cdf, thats incorrect. I think it should read like
h(v) =
 \mathrm{round}
 \left(
   \frac {N_ k - N_{kmin}} {(M \times N) - N_{kmin}}
   \times (L - 1)
 \right)
where Nk= the sum of all the appearances of values N1,N2...Nk  —Preceding unsigned comment added by 94.67.130.221 (talk) 12:49, 5 February 2011 (UTC)
thread_title:  bad formula? 

message: ===Small image===
The following is the same 8x8 subimage as used in JPEG.  The 8-bit greyscale image shown has the following values:
:
\begin{bmatrix}
 52 & 55 & 61 & 66 & 70 & 61 & 64 & 73 \\
 63 & 59 & 55 & 90 & 109 & 85 & 69 & 72 \\
 62 & 59 & 68 & 113 & 144 & 104 & 66 & 73 \\
 63 & 58 & 71 & 122 & 154 & 106 & 70 & 69 \\
 67 & 61 & 68 & 104 & 126 & 88 & 68 & 70 \\
 79 & 65 & 60 & 70 & 77 & 68 & 58 & 75 \\
 85 & 71 & 64 & 59 & 55 & 61 & 65 & 83 \\
 87 & 79 & 69 & 68 & 65 & 76 & 78 & 94
\end{bmatrix}
The histogram for this image is shown in the following table.  Pixel values that have a zero count are excluded for the sake of brevity.
:
Value	Count	Value	Count	Value	Count	Value	Count	Value	Count
52   	1    	64   	2    	72   	1    	85   	2    	113  	1
55   	3    	65   	3    	73   	2    	87   	1    	122  	1
58   	2    	66   	2    	75   	1    	88   	1    	126  	1
59   	3    	67   	1    	76   	1    	90   	1    	144  	1
60   	1    	68   	5    	77   	1    	94   	1    	154  	1
61   	4    	69   	3    	78   	1    	104  	2    	     	
62   	1    	70   	4    	79   	2    	106  	1    	     	
63   	2    	71   	2    	83   	1    	109  	1    	     	
The cumulative distribution function (cdf) is shown below.  Again, pixel values that do not contribute to an increase in the cdf are excluded for brevity.
:
Value	cdf	Value	cdf	Value	cdf	Value	cdf	Value	cdf
52   	1  	64   	19 	72   	40 	85   	51 	113  	60
55   	4  	65   	22 	73   	42 	87   	52 	122  	61
58   	6  	66   	24 	75   	43 	88   	53 	126  	62
59   	9  	67   	25 	76   	44 	90   	54 	144  	63
60   	10 	68   	30 	77   	45 	94   	55 	154  	64
61   	14 	69   	33 	78   	46 	104  	57 	     	
62   	15 	70   	37 	79   	48 	106  	58 	     	
63   	17 	71   	39 	83   	49 	109  	59 	     	
This cdf shows that the minimum value in the subimage is 52 and the maximum value is 154.  The cdf of 64 for value 154 coincides with the number of pixels in the image.  The cdf must be normalized to [0,255]. The general histogram equalization formula is:
:
h(v) =
 \mathrm{round}
 \left(
   \frac {cdf(v) - cdf_{min}} {(M \times N) - cdf_{min}}
   \times (L - 1)
 \right)
Where cdfmin is the minimum value of the cumulative distribution function (in this case 1), M × N gives the image's number of pixels (for the example above 64, where M is width and N the height) and L is the number of grey levels used (in most cases, like this one, 256). The equalization formula for this particular example is:
:
h(v) =
 \mathrm{round}
 \left(
   \frac {cdf(v) - 1} {63}
   \times 255
 \right)
For example, the cdf of 78 is 46.  (The value of 78 is used in the bottom row of the 7th column.)  The normalized value becomes
:
h(78) =
 \mathrm{round}
 \left(
   \frac {46 - 1} {63}
   \times 255
 \right)
=
 \mathrm{round}
 \left(
   0.714286
   \times 255
 \right)
=
182
Once this is done then the values of the equalized image are directly taken from the normalized cdf to yield the equalized values:
:
\begin{bmatrix}
   0 &  12 &  53 &  93 & 146 &  53 &  73 & 166 \\
  65 &  32 &  12 & 215 & 235 & 202 & 130 & 158 \\
  57 &  32 & 117 & 239 & 251 & 227 &  93 & 166 \\
  65 &  20 & 154 & 243 & 255 & 231 & 146 & 130 \\
  97 &  53 & 117 & 227 & 247 & 210 & 117 & 146 \\
 190 &  85 &  36 & 146 & 178 & 117 &  20 & 170 \\
 202 & 154 &  73 &  32 &  12 &  53 &  85 & 194 \\
 206 & 190 & 130 & 117 &  85 & 174 & 182 & 219 
\end{bmatrix}
Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.
	Code the message “ANDHRA” using arithmetic coding algorithm.  — Preceding unsigned comment added by 106.51.243.6 (talk) 14:25, 16 November 2013 (UTC)
thread_title: Examples

message: The following is the same 8x8 subimage as used in JPEG.  The 8-bit greyscale image shown has the following values:
:
\begin{bmatrix}
 52 & 55 & 61 & 66 & 70 & 61 & 64 & 73 \\
 63 & 59 & 55 & 90 & 109 & 85 & 69 & 72 \\
 62 & 59 & 68 & 113 & 144 & 104 & 66 & 73 \\
 63 & 58 & 71 & 122 & 154 & 106 & 70 & 69 \\
 67 & 61 & 68 & 104 & 126 & 88 & 68 & 70 \\
 79 & 65 & 60 & 70 & 77 & 68 & 58 & 75 \\
 85 & 71 & 64 & 59 & 55 & 61 & 65 & 83 \\
 87 & 79 & 69 & 68 & 65 & 76 & 78 & 94
\end{bmatrix}
The histogram for this image is shown in the following table.  Pixel values that have a zero count are excluded for the sake of brevity.
:
Value	Count	Value	Count	Value	Count	Value	Count	Value	Count
52   	1    	64   	2    	72   	1    	85   	2    	113  	1
55   	3    	65   	3    	73   	2    	87   	1    	122  	1
58   	2    	66   	2    	75   	1    	88   	1    	126  	1
59   	3    	67   	1    	76   	1    	90   	1    	144  	1
60   	1    	68   	5    	77   	1    	94   	1    	154  	1
61   	4    	69   	3    	78   	1    	104  	2    	     	
62   	1    	70   	4    	79   	2    	106  	1    	     	
63   	2    	71   	2    	83   	1    	109  	1    	     	
The cumulative distribution function (cdf) is shown below.  Again, pixel values that do not contribute to an increase in the cdf are excluded for brevity.
:
Value	cdf	Value	cdf	Value	cdf	Value	cdf	Value	cdf
52   	1  	64   	19 	72   	40 	85   	51 	113  	60
55   	4  	65   	22 	73   	42 	87   	52 	122  	61
58   	6  	66   	24 	75   	43 	88   	53 	126  	62
59   	9  	67   	25 	76   	44 	90   	54 	144  	63
60   	10 	68   	30 	77   	45 	94   	55 	154  	64
61   	14 	69   	33 	78   	46 	104  	57 	     	
62   	15 	70   	37 	79   	48 	106  	58 	     	
63   	17 	71   	39 	83   	49 	109  	59 	     	
This cdf shows that the minimum value in the subimage is 52 and the maximum value is 154.  The cdf of 64 for value 154 coincides with the number of pixels in the image.  The cdf must be normalized to [0,255]. The general histogram equalization formula is:
:
h(v) =
 \mathrm{round}
 \left(
   \frac {cdf(v) - cdf_{min}} {(M \times N) - cdf_{min}}
   \times (L - 1)
 \right)
Where cdfmin is the minimum value of the cumulative distribution function (in this case 1), M × N gives the image's number of pixels (for the example above 64, where M is width and N the height) and L is the number of grey levels used (in most cases, like this one, 256). The equalization formula for this particular example is:
:
h(v) =
 \mathrm{round}
 \left(
   \frac {cdf(v) - 1} {63}
   \times 255
 \right)
For example, the cdf of 78 is 46.  (The value of 78 is used in the bottom row of the 7th column.)  The normalized value becomes
:
h(78) =
 \mathrm{round}
 \left(
   \frac {46 - 1} {63}
   \times 255
 \right)
=
 \mathrm{round}
 \left(
   0.714286
   \times 255
 \right)
=
182
Once this is done then the values of the equalized image are directly taken from the normalized cdf to yield the equalized values:
:
\begin{bmatrix}
   0 &  12 &  53 &  93 & 146 &  53 &  73 & 166 \\
  65 &  32 &  12 & 215 & 235 & 202 & 130 & 158 \\
  57 &  32 & 117 & 239 & 251 & 227 &  93 & 166 \\
  65 &  20 & 154 & 243 & 255 & 231 & 146 & 130 \\
  97 &  53 & 117 & 227 & 247 & 210 & 117 & 146 \\
 190 &  85 &  36 & 146 & 178 & 117 &  20 & 170 \\
 202 & 154 &  73 &  32 &  12 &  53 &  85 & 194 \\
 206 & 190 & 130 & 117 &  85 & 174 & 182 & 219 
\end{bmatrix}
Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.
	Code the message “ANDHRA” using arithmetic coding algorithm.  — Preceding unsigned comment added by 106.51.243.6 (talk) 14:25, 16 November 2013 (UTC)
thread_title: Small image

message: The current histogram-equalized version of the 8x8 example image has errors, or at least doesn't match the matrix generated in the example.
For example, this image should be significantly lighter at pixel position [1, 3] (Coordinates counted from 0 starting at top left corner) to match this the final histogram-equalized matrix. I think the problem is with the image, not the matrix because when I was reproducing the 8x8 example, my results matched the matrix rather than the image.
I generated my own image with the correct greyscale values, but Wikipedia isn't accepting my upload.
— Preceding unsigned comment added by Isears (talk • contribs) 14:16, 31 December 2020 (UTC)
thread_title:  Histogram-equalized 8x8 example image has errors (possibly due to JPEG loss?) 

message: The notation h(v) is incorectly used several times. h(v) would be the new values of the histogram for that specific pixel value, but it is used when calculating the actual new pixel value of the transformed image resulted from the process of histogram equalization. A.Roman2104 (talk) 02:20, 27 January 2023 (UTC)
thread_title:  The notations are wrong