Height-Height Correlation Function or Height Difference Correlation Function

6 Ansichten (letzte 30 Tage)
Allen
Allen am 11 Okt. 2013
Beantwortet: James am 13 Jan. 2017
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

Antworten (3)

Image Analyst
Image Analyst am 11 Okt. 2013
diffImage = conv2(grayImage, [-1, 1], 'valid'); % Diffs in x direction.
G = mean(diffImage .^ 2, 2);
  2 Kommentare
Allen
Allen am 11 Okt. 2013
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 am 11 Okt. 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.

Melden Sie sich an, um zu kommentieren.


Efthymios
Efthymios am 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 Kommentare
Image Analyst
Image Analyst am 11 Jun. 2014
I don't understand the question or what you want to do, either here or in your other link.
Efthymios
Efthymios am 12 Jun. 2014
Bearbeitet: Efthymios am 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 ...

Melden Sie sich an, um zu kommentieren.


James
James am 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 &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.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by