How to integrate discrete values over a known x, y coordinate image
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
haha mark
am 13 Mai 2020
Kommentiert: haha mark
am 15 Mai 2020
I know a digital image f (x, y), and the corresponding power spectrum is obtained by Fourier transform, but I need to request the integration of the power spectrum in an annular area, I want to use integral2 It is, but I only have the value of f (x, y) and the coordinate value (x, y), I do n’t know how to use double integration。
ps:the power spectrum like this

and I want to integrate the power spectrum in an annular region like this

and the integral is 
I=fftshift(ft2(image);
s_power = abs(I).^2;
But s_powers is (x, y) coordinate, I could not calculate its double integral, ask for help!SOS!
4 Kommentare
Akzeptierte Antwort
darova
am 13 Mai 2020
Here is the idea
% calculate increments
dx = x(2)-x(1);
dy = y(2)-y(1);
% assume A is your image
% assume X and Y are your 2d matrices of coordinates
R = hypot(X,Y); % calculate radius
ix = r1 <= R & R <= r2; % boundaries of integration
A1 = A*0; % preallocation
A1(ix) = A(ix); % region of interest
S = 0;
for i = 1:size(A1,1)
for j = 1:size(A1,2)
s = A1(i:i+1,j:j+1); % 4 neigbour values
S = S + sum(s(:)); % sum values
end
end
S = S*dx*dy/4; % value of integral
3 Kommentare
darova
am 14 Mai 2020
You are calculating volume under the the surface
Volume is average height and dx,dy: 

I forgot to add this line. It's because you have a complicated shape, you have to sum only nonzero values
s = A1(i:i+1,j:j+1); % 4 neigbour values
if all(s(:))
S = S + sum(s(:)); % sum values
end
Little explanation

Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation 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!