1 | initial version |
I'm not a python expert but I think that's a good answer to your question :
f(0,0)=1, f(1,0)=3 f(0,1)=5, f(1,1)=4
import numpy as np
from numpy.linalg import inv
# Load an color image in grayscale
z = np.array([[1], [3], [5], [4]])
m=np.array([[0, 0 ,1],[1,0 ,1],[0 ,1 ,1],[1 ,1 ,1]]);
print ("z = ",z)
print ("m = ",m)
mm=np.dot(m.T,m)
pinvm = inv(mm)
a= np.dot(pinvm,np.dot(m.T,z))
print ("a = ",a )
zz = np.dot(np.array([[0.5, 0.5 ,1]]),a)
print ("z = ",zz )
results interolate point at 0.5,0.5 is 3.25 :
z = [[1]
[3]
[5]
[4]]
m = [[0 0 1]
[1 0 1]
[0 1 1]
[1 1 1]]
a = [[0.5 ]
[2.5 ]
[1.75]]
z = [[3.25]]
Appuyez sur une touche pour continuer...
this answer is off topics : no opencv function
2 | No.2 Revision |
I'm not a python expert but I think that's a good answer to your question :
f(0,0)=1, f(1,0)=3 f(0,1)=5, f(1,1)=4
import numpy as np
from numpy.linalg import inv
# Load an color image in grayscale
z = np.array([[1], [3], [5], [4]])
m=np.array([[0, 0 ,1],[1,0 ,1],[0 ,1 ,1],[1 ,1 ,1]]);
print ("z = ",z)
print ("m = ",m)
mm=np.dot(m.T,m)
pinvm = inv(mm)
a= np.dot(pinvm,np.dot(m.T,z))
print ("a = ",a )
zz = np.dot(np.array([[0.5, 0.5 ,1]]),a)
print ("z = ",zz )
results interolate point at 0.5,0.5 is 3.25 :
z = [[1]
[3]
[5]
[4]]
m = [[0 0 1]
[1 0 1]
[0 1 1]
[1 1 1]]
a = [[0.5 ]
[2.5 ]
[1.75]]
z = [[3.25]]
Appuyez sur une touche pour continuer...
this answer is off topics : no opencv function
In c++ it's here with opencv function
3 | No.3 Revision |
I'm not a python expert but I think that's a good answer to your question :
f(0,0)=1, f(1,0)=3 f(0,1)=5, f(1,1)=4
import numpy as np
from numpy.linalg import inv
# Load an color image in grayscale
z = np.array([[1], [3], [5], [4]])
m=np.array([[0, 0 ,1],[1,0 ,1],[0 ,1 ,1],[1 ,1 ,1]]);
print ("z = ",z)
print ("m = ",m)
mm=np.dot(m.T,m)
pinvm = inv(mm)
a= np.dot(pinvm,np.dot(m.T,z))
print ("a = ",a )
zz = np.dot(np.array([[0.5, 0.5 ,1]]),a)
print ("z = ",zz )
results interolate interpolate point at 0.5,0.5 is 3.25 :
z = [[1]
[3]
[5]
[4]]
m = [[0 0 1]
[1 0 1]
[0 1 1]
[1 1 1]]
a = [[0.5 ]
[2.5 ]
[1.75]]
z = [[3.25]]
Appuyez sur une touche pour continuer...
this answer is off topics : no opencv function
In c++ it's here with opencv function
4 | No.4 Revision |
I'm not a python expert but I think that's a good answer to your question :
f(0,0)=1, f(1,0)=3 f(0,1)=5, f(1,1)=4
I want to solve f(i,j)=z = M a where p=[ a0 a1 a2] and a0 xi+ a1yi +a2 =zi
import numpy as np
from numpy.linalg import inv
z = np.array([[1], [3], [5], [4]])
m=np.array([[0, 0 ,1],[1,0 ,1],[0 ,1 ,1],[1 ,1 ,1]]);
print ("z = ",z)
print ("m = ",m)
mm=np.dot(m.T,m)
pinvm = inv(mm)
a= np.dot(pinvm,np.dot(m.T,z))
print ("a = ",a )
zz = np.dot(np.array([[0.5, 0.5 ,1]]),a)
print ("z = ",zz )
results interpolate point at 0.5,0.5 is 3.25 :
z = [[1]
[3]
[5]
[4]]
m = [[0 0 1]
[1 0 1]
[0 1 1]
[1 1 1]]
a = [[0.5 ]
[2.5 ]
[1.75]]
z = [[3.25]]
Appuyez sur une touche pour continuer...
this answer is off topics : no opencv function
In c++ it's here with opencv function