I am new in image processing.I know that pixels in the same image are correlated with each other but I don't know how can I draw the relationship b/w these pixels in the form of graph?.

  • 2
    $\begingroup$ Can you post an image as an example and provide more information, e.g. on the type of image (gray levels, color, dynamic range, ...). And what kind of correlation do you mean (e.g. linear, non-linear, ...)? $\endgroup$
    – M529
    May 15, 2016 at 9:12
  • $\begingroup$ what do you mean by non-linear linear ,correlation and dynamic range.Can you explain these terms and their significance.Infact I have gray scaled image $\endgroup$ May 17, 2016 at 7:08
  • $\begingroup$ See the first image at en.wikipedia.org/wiki/Correlation_and_dependence for examples of linear and non-linear correlation. It is important to know the kind of correlation, since it determines the way to compute the correlation. As you can see in the wiki image, linear correlation measures can totally fail to quantify non-linear correlations. Dynamic range: Are your gray values continuous or quantized as integers? What are the min/max values, if there are any? $\endgroup$
    – M529
    May 17, 2016 at 9:20

2 Answers 2


If you would like to show that in natural images, neighboring pixels tend to have similar values, you can use the cooccurrence matrix. The values in the matrix will be distributed mostly along the diagonal.

In the snapshot below, the second image is random and non-correlated. For that image the cooccurrence matrix is pretty much a constant. I'm not showing the matrices themselves, but a plot of their values such that white means '0'.

enter image description here

  • $\begingroup$ What's the relationship to 2D cross-correlation? They seem similar $\endgroup$
    – endolith
    Jun 21, 2017 at 14:18

Try plotting a histogram of all the pixel intensity values in the image to understand the correaltion between the pixels

Matlab Code:

img = imread('fig.jpg');

This gives u a histogram showing intensity values to understand the pixel values.. Check this: http://www.mathworks.com/help/images/ref/imhist.html

  • 1
    $\begingroup$ An image histogram looses all the geometric distribution information such as the correlation of neighbouring pixels hence cannot be used to deduce the amount of correlation between pixels. $\endgroup$
    – Fat32
    Jun 21, 2017 at 19:18

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.