List Values Average
in
Programming Questions
•
1 month ago
Hi all!
I have the following two-dimensional loop that receives values from an incoming source (streaming values of x and y), and I would like to create the average of these incoming values.
Can you suggest a method for accomplishing this?
Thank you beforehand
for (int ix=0;ix<gw;ix++) {
int x0=ix*gs+gs2;
for (int iy=0;iy<gh;iy++) {
int y0=iy*gs+gs2;
int ig=iy*gw+ix;
float u=df*sflowx[ig];
float v=df*sflowy[ig];
// draw the line segments for optical flow
float a=sqrt(u*u+v*v);
//Average a ?
}
}
1