So, I have to implement an algorithm of Constant False Alarm Rate(CFAR). It kind of works like this:
I am using the notion that, in case that the target window contains more than one pixels, this operator (CFAR) uses the following detection criterion
where μt is the mean value of pixels in the target window. In this case, t should be replaced by t√n (where n is the number of pixels in the target window) in the PFA calculation, and where μb is the background mean, σb is the background standard deviation and t is a detector design parameter which is computed from PFA by the following equation:
Now, (enough with the equations already! XD), I know that I have to implement some loops over an image (which is a 2d matrix). I know the pixel to distance ratio for my image (which is 10.054m per pixel in both directions approximately). I can translate the distance entered by user into pixel sizes, suppose the background window is 800m (roughly 80 pixel), the guard window is 400m (roughly 40 pixel), while the target window is given to be 20m (roughly 2 pixel). My question is:
How to loop over the image?
The problem is not as easy as it seems, atleast not to me. You see, I can't figure out, for mxn pixels, how to implement the moving window. At first I thought that the target size would be fixed, and I could hardcode my pixel coordinates, but that is not the point. Any help is appreciated :)
EDIT: The Target window moves inside the guard window. After this has finished, the guard window will move inside the background window, where the above will again take place, then finally the background window will move across the whole image!