They have given me this code in which they tell me that I can correct a prospective projection. Obtaining the X and Y vectors of the projection in their corrected position.
But I don't know very well how to run it within B4A, and I see some clues with the MatrixOP library but I don't know if it can be done, and what I am doing is correct.
I would appreciate any help. Thanks.
But I don't know very well how to run it within B4A, and I see some clues with the MatrixOP library but I don't know if it can be done, and what I am doing is correct.
I would appreciate any help. Thanks.
B4X:
'distorted reference points
Dim xd(5) As Int
xd(1) = 0
xd(2) = 1000
xd(3) = 1000
xd(4) = 0
Dim yd(5) As Int
yd(1) = 0
yd(2) = 0
yd(3) = 600
yd(4) = 600
'unidistorted points
Dim xu(5) As Int
xu(1) = 1600+200
xu(2) = 1600+200
xu(3) = 1000+200
xu(4) = 1000+200
Dim yu(5) As Int
yu(1) = 0
yu(2) = 1000
yu(3) = 1000
yu(4) = 0
'solve 8 equaciones lineales syste : A * k = b -> k = inv(A) * b
Dim Amatriz(8,8) As Double
Dim valoresfila1() As Int = Array As Int( xd(1), yd(1), 1, 0, 0, 0, (xd(1)*-1)*xu(1), (yd(1)*-1)*xu(1) )
For columna=0 To 7
Amatriz(0, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( 0, 0, 0, xd(1), yd(1), 1, (xd(1)*-1)*yu(1), (yd(1)*-1)*yu(1) )
For columna=0 To 7
Amatriz(1, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( xd(2), yd(2), 1, 0, 0, 0, (xd(2)*-1)*xu(2), (yd(2)*-1)*xu(2) )
For columna=0 To 7
Amatriz(2, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( 0, 0, 0, xd(2), yd(2), 1, (xd(2)*-1)*yu(2), (yd(2)*-1)*yu(2) )
For columna=0 To 7
Amatriz(3, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( xd(3), yd(3), 1, 0, 0, 0, (xd(3)*-1)*xu(3), (yd(3)*-1)*xu(3) )
For columna=0 To 7
Amatriz(4, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( 0, 0, 0, xd(3), yd(3), 1, (xd(3)*-1)*yu(3), (yd(3)*-1)*yu(3) )
For columna=0 To 7
Amatriz(5, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( xd(4), yd(4), 1, 0, 0, 0, (xd(4)*-1)*xu(4), (yd(4)*-1)*xu(4) )
For columna=0 To 7
Amatriz(6, columna) = valoresfila1(columna)
Next
Dim valoresfila1() As Int = Array As Int( 0, 0, 0, xd(4), yd(4), 1, (xd(4)*-1)*yu(4), (yd(4)*-1)*yu(4) )
For columna=0 To 7
Amatriz(7, columna) = valoresfila1(columna)
Next
Dim b() As Double
b = Array As Double( xu(1), yu(1), xu(2), yu(2), xu(3), yu(3), xu(4), yu(4) )
Dim matr As MatrixOp
Dim k As Double
k = matr.SolveV(8,Amatriz,b, XXXXXXXXXXX )