Height-Height Correlation Function or Height Difference Correlation Function
显示 更早的评论
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
回答(3 个)
Image Analyst
2013-10-11
diffImage = conv2(grayImage, [-1, 1], 'valid'); % Diffs in x direction.
G = mean(diffImage .^ 2, 2);
2 个评论
Allen
2013-10-11
Image Analyst
2013-10-11
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
2014-6-11
0 个投票
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 个评论
José-Luis
2014-6-11
Did you replace grayImage by your own image?
Efthymios
2014-6-11
Has to be in grayscale only ?
I have posted my problem as a question here http://www.mathworks.com/matlabcentral/answers/133408-how-to-plot-a-height-height-correlation-function-from-afm-image It says exactly what i want to have; AFM image and i want the height height correlation function G(r) = ....... the well known formula as Allen mentions in this post , whereas the h(r) is the height of every point of my AFM image .
Image Analyst
2014-6-11
I don't understand the question or what you want to do, either here or in your other link.
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
2017-1-13
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!