Histogram Image Processing – How to Compare Two Histograms Effectively

histogramimage processing

I would like to know what are the common techniques to compare two histograms?
I have histogram of two images and I want to see are they similar or not meaning that is there any correlation between them or not. The histograms are for two different parts of tissue.

enter image description here

Best Answer

If you understand a graphical technique under ''comparison'' you should probably try a QQ-plot (qqplot under R).

If you are thinking of an analytical way (i.e. statistical test), the two-sample Kolmogorov-Smirnov test is the most classical way (ks.test under R). There are other, more modern goodness-of-fit tests (this is how your task called statistically, this case in a two-sample sense) available, such as Anderson-Darling test (ad.test from the package kSamples).

You might also consider binning the data (with cut) and then performing a $\chi^2$-squared test (chisq.test).

(If you don't want to compare the whole distribution, just some characteristics, such as the mean or variance, you get back to elementary statistical tests. Also note that the above was a non-parametrical approach; if you're willing to assume some functional form for the distributions, you can also use classical tests.)

Note that for very large sample sizes (which might be the case judging from your histogram) you will likely obtain significant results from every test. (They'll have extremely high power, detecting even minuscule deviations from the null.) In that case, graphical techniques (QQ-plot) might be still useful to decide how large is the deviation.