Forums

How to obtain the result faster when dealing with array?

Started by vin_ng_2000 November 30, 2003
I find that it is very time-consuming when using for loop to access
the array. Here is my problem:

I have to construct a 3D array by comparing two image files. I have
to compare the pixel (r, c) in the left image and (r, c-d) in the
right image, where d is 0 to 20.

I shall get the average of the values in each image with windows of
size 3X3 centred at (r, c) for left (w) and (r, c-d) for right (w').
All pixels in the window should subtract the average and the value of
the 3D array is calculated by:
_ _
sum(w - w)(w' - w')
L(r, c, d) = -----------------------------------
_ _
sqrt(sum(w - w))(sqrt(sum(w' - w')) Is there any fast method to obtain the result in software mean?