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;
```

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trialthe 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);
```

eg

| 1 1 1 |

1/12*| 1 4 1 |

| 1 1 1 |

Web Development

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

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