Height-Height Correlation Function or Height Difference Correlation Function
17 views (last 30 days)
Show older comments
I'd like to calculate the height-height correlation function for some scanning probe images that I have of research samples.
I'm highly suspicious that there's a better way than coding this from scratch. Although I'm not familiar enough with the use of cross and auto-correlations to answer this myself presently...
The equation is fairly simple - summation along one direction of the image (say along x), the average of the height differences.
G = <|h_i - h_j|^2>
I suspect the correlation equations could be used, but am unsure. Essentially the measure is a graph of the number of same-height values within the line that's used to calculate. [For a 2d image you sum along Y the results of G.]
Still digging for example code somewhere. Any suggestions are greatly appreciated.
My best! -Allen
0 Comments
Answers (3)
Image Analyst
on 11 Oct 2013
diffImage = conv2(grayImage, [-1, 1], 'valid'); % Diffs in x direction.
G = mean(diffImage .^ 2, 2);
2 Comments
Image Analyst
on 11 Oct 2013
You can change the kernel to [-1 0 0 0 0 0 0 0 0 0 0 0 0 0 1] to space them at whatever spacing you want.
Efthymios
on 11 Jun 2014
Dear Image Analyst,
Is that a 2 -line code that works you posted before ? I tried to use it but i could not. Could you please maybe help me ?
4 Comments
Image Analyst
on 11 Jun 2014
I don't understand the question or what you want to do, either here or in your other link.
Efthymios
on 12 Jun 2014
Edited: Efthymios
on 12 Jun 2014
Dear Image Analyst,
Could you please help me how to use your code ?
How should i put my file in your code ? i mean instead of the grayImage i should write the name of my file ? and with or wothout the .jpg extensions ? any ' ' to define the file ?
and what about the " 'valid' " in your code ? is it something i have to define for it or keep it like this ?? please help me ...
James
on 13 Jan 2017
You can relate the height-height correlation function to the autocorrelation function and the mean of the square of the height. Assume we have a real valued image. Then <|h(i,j) - h(i+k,j+l)|^2> = <|h(i,j)|^2> + <|h(i+k,j+l)|^2> - 2<h(i,j)h(i+k,j+l)> = 2<|h(i,j)|^2> - 2<h(i,j)h(i+k,j+l)> This can be implemented in matlab as
aCorr = (1/prod(size(I)))*xcorr2(I);
hrms = mean(I(:).^2);
hhCorr = 2*(hrms - aCorr);
I would also recommend applying a Gaussian window to the image, as xcorr2 will treat exterior pixels as zeros. It is helpful to smoothly approach this limit in AFM images, particularly when you're looking for periodic and statistical image properties.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!