For the past week I've been through numerous research papers and tutorials on Otsu's thresholding. Even wrote to the authors, but every single one of the explanations are in terms of "Class" and "variance". I'm not very good at statistics, so it's hard for me to picture what these classes and variances mean in terms of the actual image. I have a few questions (marked in bold) that lead to the main questions.

What I've understood until now:
1. We need to separate the image into two parts. The dark pixels and the light pixels. These are what are called the two classes. For this explanation could we please just call them "dark" and "light" instead of "class".
2. A histogram array of 0 to 255 positions is created, where each position holds the total number of pixels of intensity 0, 1, 2,...255. Let's say for intensities 0 to 9, the number of pixels are 20,5,23,6,3,23,5,8,67.
3. Probability for any of these intensities (assume intensity 1) are calculated as = 1 / (180 * 200), where 180 is the length of the image and 200 is the width.
4. The sum of probabilities of the dark and light pixels are the weights of the dark and light pixels.
5. Question: When we calculate the mean of the pixels, what exactly does it imply? Is it like taking an average of the probabilities? If it is like an average, then if the threshold is at position 100 of the histogram, why can't we simply calculate it as: (sum of intensities from 0 to 99) / (99) ? What extra benefit do we have by doing a complex calculation of mean?
6. Then we have variances of distribution of pixels from the mean, which I understand, but Question: when we take the sum of variances of the light pixels and sum of variances of dark pixels, what does it imply? Does it speak of the amount of variation of intensity present in the dark pixels vs the light pixels?
7. Question: What is a "within class variance" and a "between class variance" in plain English? I can see the formula, but it makes no sense. Is the within class variance just a way of saying "how much the dark pixels vary with respect to mid-darkest pixel plus how much the light pixels vary with respect to the mid-lightest pixel"?
8. Question: What is a "between class variance" in plain English? The formula itself is odd, because there is no variance, but just a sum of the wights and means. But still, what does it mean in plain English, in terms of the pixels?

ps: Kindly refrain from statistical/mathematical terms and please try to explain it in plain English the way I've put some explanations in quotes above. I (and many people in this world) have a hard time understanding statistical jargon because it was taught in a way that never allowed us to fully understand it.


1 Answer 1


i'm avoiding labels light and dark because you could say that we choose 128 as threshold which perfectly separate light and dark pixels but consider you have a picture with only two gray levels which are 240 and 250 and you want to label them but both seems to be light.

now consider an example which you have a part of x-ray image which composed of soft tissue and bone and you want to separate them. we know bones generally have higher intensity than soft tissue in x-ray image. but some part of bones are very thin and some part of soft tissue is very thick so some pixels which belong to bone have lower intensity than pixels belong to a soft tissue. in this problem any threshold that we choose lead to some miss labeled pixels.

lets consider more details. bones have thick and thin areas which lead to a variance around average intensity of bones, this variance is called within class variance and the average value represent the bone intensity value. the same is true for soft tissue. the difference between average of soft tissue and average of bone is called between class variance.

in ideal situation we have minimum within class variance and the averages must be as far as possible from each other (highest between class variance) to have the minimum mixing between these two groups.

  • $\begingroup$ Thank you Mohammad, but in my question, you'll see few words marked in bold which say "Question". Those questions are exactly what I need answers to. I got a slightly better idea about the between class variance and within class variance, but if you see my question again, there is a bit more explanation needed for it to be clearer. $\endgroup$
    – Nav
    Aug 28, 2017 at 11:10
  • $\begingroup$ well i didn't get what do you mean by your first question, and i think other questions asking about the meaning of within class and between class variance which i think has been answered generally, but if you tell me what is still confusing, I would be happy to help. $\endgroup$
    – Mohammad M
    Aug 28, 2017 at 13:13
  • $\begingroup$ and your ideas in second and third question is somehow true ( you have to restate them more carefully regarding the mathematical definitions ) $\endgroup$
    – Mohammad M
    Aug 28, 2017 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.