Height-Height Correlation Function or Height Difference Correlation Function

조회 수: 9 (최근 30일)
Allen
Allen 2013년 10월 11일
답변: James 2017년 1월 13일
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
Image Analyst 2013년 10월 11일
diffImage = conv2(grayImage, [-1, 1], 'valid'); % Diffs in x direction.
G = mean(diffImage .^ 2, 2);
  댓글 수: 2
Allen
Allen 2013년 10월 11일
Hmm- actually, this is quite good - it does what I specifically stated in the question.
Unfortunately, I got the question I was asking wrong! :) ugh.
The height-height correlation function gives a value of height differences accumulated at a distance x apart from each other...
An example of this discussion and implementation by the authors of the free SPM software Gwyddion can be seen here: Gwyddion User Manual: Height Height Correlation Function
The interest I have in duplicating some of these computations is in varying the ways I measure the HHCF and for confirming the measures of Gwyddion.
Now, I think I may be able to take the code above and do some sort of iterative conv2 through each subsequent point along x, then sum their values for each distance x away from the original point.... hmm.... ugh. not sure.
Sorry I asked the question improperly, Image Analyst, I appreciated the above code and answer!
[I'm not sure I should answer it "accepted" or leave it open - certainly you answered appropriately for my question.]
Thank you for your kind reply!
Image Analyst
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
Efthymios 2014년 6월 11일
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
Image Analyst
Image Analyst 2014년 6월 11일
I don't understand the question or what you want to do, either here or in your other link.
Efthymios
Efthymios 2014년 6월 12일
편집: Efthymios 2014년 6월 12일
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
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 &lt|h(i,j) - h(i+k,j+l)|^2&gt = &lt|h(i,j)|^2&gt + &lt|h(i+k,j+l)|^2&gt - 2&lth(i,j)h(i+k,j+l)&gt = 2&lt|h(i,j)|^2&gt - 2&lth(i,j)h(i+k,j+l)&gt 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.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by