Image Processing - Absolute sum of the differences employing a weighted kernel
2 views (last 30 days)
I hope you can help. I am trying to replicate an alghoritm (for target detection) found in a research paper:
Unfortunately, I am stuck with an equation (see Eq. 20 and 21 in the link above), and I would grately appreciate your help.
I have an image, let's call it I (I=5x5).
I performed a Top-hat transform and now I need to apply a 'Local Difference Criterion'.
I created four direction vectors centered at I(i,j), where i and j are the coordinates of the central pixel. The four vectors are defined as:
Now, I need to calculate the sum of the differences in gray values between I(i+x,j+y) and I(i,j) as follows:
where Wx,y is the weighted kernel to describe the absolute difference between I(i+x,j+y) and I(i,j), and is equal to:
Would anyone be able to help me with writing a code to accomplish the above?
Thanks a lot in advance
Matt J on 1 May 2023
Edited: Matt J on 1 May 2023
There are problems with the mathematical formulation, as noted in the comments above. However, for the general task of computing shift-invariant weighted differences, I would set it up like the following:
L(1).deltaX=[-2 -1 1 2]
L(1).deltaY=[-2 -1 1 2]
L(2).deltaX=[0 0 0 0]
L(2).deltaY=[-2 -1 1 2]
x=L(i).deltaX(j); y=L(i).deltaY(j); wxy=L(i).weight(j);