The revolutionary project management tool is here! Plan visually with a single glance and make sure your projects get done.

i have an image and for each pixel i want sum the neighbours of the pixel in the following way:

suppose that P is the pixel:

N1 N2 N3

N8 P N4

N7 N6 N5

the part of the algorithm that i don't understand is d_8(h,p) = 1:

for each neighbor h of P / d_8(h,p) = 1 do

S = S + S0(h)

S = S/8;

does that mean that the sum must be equal to 1? can i force it to be equal to 1 whatever the value of the neighbours? i didn't understand it. can u give me an example please???

suppose that P is the pixel:

N1 N2 N3

N8 P N4

N7 N6 N5

the part of the algorithm that i don't understand is d_8(h,p) = 1:

for each neighbor h of P / d_8(h,p) = 1 do

S = S + S0(h)

S = S/8;

does that mean that the sum must be equal to 1? can i force it to be equal to 1 whatever the value of the neighbours? i didn't understand it. can u give me an example please???

```
%Is there something missing for the condition d_8(h,p) = 1???
Dx1 = (Dx(x1,y1) + Dx(x2,y2)+ Dx(x3,y3) + Dx(x4,y4)...
+ Dx(x5,y5)+ Dx(x6,y6)+ Dx(x7,y7)+ Dx(x8,y8));
Dx1 = Dx1 / 8;
```

2 Solutions

the initial formula was:

(1/N(p) )* Summation(8-neighbors)

with N(p) = 8 so A = 1 and B = 0.

Hani.

```
Dx1 = (A*(Dx(x1,y1) + Dx(x2,y2)+ Dx(x3,y3) + Dx(x4,y4)+ Dx(x5,y5)+ Dx(x6,y6)+ Dx(x7,y7)+ Dx(x8,y8)) + B * Dx(i1,j1))/(8*A + B);
```

Tackle projects and never again get stuck behind a technical roadblock.

Join Now
about, but as you are talking about smoothness, I will assume a "8-neighborhood" property to make pixeld_8(h,p) = 1to receive influence of the pixels around, thus lowering the crispness of the image.PWhen we use a 3x3 matrix (being the focused pixel in the middle of such matrix) we can decide how much the pixels around will combine with the central pixel

. What we do is to define, for example, a factor ofPfor each of the 8 pixels around and a factorAfor the target pixelB. If you decide for A=1 and B=1, you simply add the values and divide them by 9. If you want more weight for P, then you decide, for instance, for B=3 and divide the sum of all the 9 pixels by 11.PNew P = ( A(N1+..+N8) + B*P) / (8A + B)

That way, the matrix is

| 1 1 1 |

| 1 3 1 |

| 1 1 1 |

Jose