Reputation: 1
I have a few double integrals that I have to approximate that are based on getting motion parameters from a sequence of images, and I have chosen to use Riemann Sums for that purpose. These integrals are under the domain R = [-w,w]x[-h,h], where 2w and 2h are the image width and height respectively. What would be the appropriate number of subdivisions m and n that I can give so that I can use code to evaluate them in any case? I am confused as we don't have access to all values of x_ij and y_ij as m and n increases.
I was thinking of considering each of the image frames as my grid of values, but I don't know what each of the pixel width and height would be. I am not even sure if this is the correct approach to approximating the integrals, so please suggest if there are other appropriate ways.
Here is one of the integrals that I am approximating:-
∫∫((u-ur)β - (v - vr)α)(-xyβ + (y^2 + 1)α)dxdy
Upvotes: -2
Views: 64
Reputation: 153
If the cost of integrating is not too high, you can compute the integral exactly. Otherwise, you can decouple the problem:
For the first part, there are many quadrature schemes you can use. A very simple but already better than Riemann sums is the trapezoid rule. Especially since your function is a step-function of sorts (piecewise-constant).
In practice, integrating exactly will be cheaper than generating those images, and probably even than reading them from disk (which you presumably have to do). So let's say you want to compute the integrals exactly. A function defined over the pixels writes
with chi the indicatrix function. The x_i, y_i are the coordinates of your pixel corners. What do you want to map those to? I would propose a scheme where the image size is invariant w.r.t. pixel count, such as any:
with W the width and H the height (here 2w and 2h). This is up to your problem definition, you can change it for other values as needed. Now, for all i,j,
so your integral over the entire domain is simply
This is the exact integral of a quantity defined pixel-by-pixel.
Upvotes: 0