# Given a center, sum adjacent pixels

2 visualizzazioni (ultimi 30 giorni)
MementoMori il 3 Ott 2022
Modificato: Matt J il 3 Ott 2022
Hi, suppose I have a matrix A and I have a center (for example (10.3,14.6)). Now I want to calculate the value of the center in this way
value = w1*A(10,14) + w2*A(10,15) + w3*A(11,14) + w4*A(11,15)
w1, w2, w3, w4 are the values of the weigths that are proportional to the distance of the pixel from the center.
What is the most correct way to evaluate w1, w2, w3, w4? I want that the weigth of the pixel that is closer to the center higher and the weigth of the pixel that is farther to the center lower and so on.
My hyphotesis is something like this:
w1=0.7 * 0.4 ; w2=0.7*0.6; w3=0.3*0.4; w4= 0.3*0.6
Thanks
##### 6 CommentiMostra 5 commenti meno recentiNascondi 5 commenti meno recenti
MementoMori il 3 Ott 2022
the sum of the weights is 1. 0.7*0.4 + 0.7*0.6 + 0.3*0.4 + 0.3*0.6 =1
I think linear proportional and I don't know for distance, what is the most suitable?

Accedi per commentare.

### Risposte (1)

Matt J il 3 Ott 2022
Modificato: Matt J il 3 Ott 2022
Use interp2:
value=interp2(A,14.3,10.6)
##### 0 CommentiMostra -1 commenti meno recentiNascondi -1 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Image Arithmetic in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by