Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
22 Views

Use of Least Square Method on IPP

Hi together,

I'm writing at the moment a Class for Calibrating Cameras with the Tsai Algorithm. Now I have problems to use the IPP for the solution of the overdetermined linear system of equations (maybe the reason is, that school is date back ;-) )

Well I thought I could use one of the two "Least Squares Problem Function" of the IPP. But my structure of equation is:

[A1n A2n A3n A4n A5n A6n A7n] [x1 x2 x3 x4 x5 x6 x7]T = [Bn]

n = 0...Count Of Rows
all Ain and Bn are known an all xi are unknown.

How I have to use the transfer parameters of the ipp functions? Can anybody help me, please?
And - yes I know that I'm bad in mathematic.





0 Kudos
4 Replies
Highlighted
Beginner
22 Views

Well I could answer a part of my question by myself.

1. Step:

ippmQRDecomp_m_32f(&A[0], A-Width*4, 4, pBuffer, &AQDR[0], A-Width*4, 4, 7, height);

2. Step:

ippmQRBackSubst_mv_32f(&AQDR[0], A-Width*4, 4, pBuffer, &B[0], 4, &B[0], 4, 7, height);


I think this is the right way for the solution of this overdetermined linear system of equations.

But: In Step 1 there occurs the Error

ippStsDivByZeroErr = Returns an error when the source matrix has an incomplete column rank

Has anyone of you any idear? I'm quite sure about the strides, but this means that the column rank is wrong - what I can not imagine..

0 Kudos
Highlighted
Beginner
22 Views

Ok I like to share my new knowledge with you ;-)

In my opinion it seems to be a bug in the IPP or the documentation: it works if I swap srcStride1 and srcStride2 !! I will report this to Intel and don't need any further help. I'm just a little bit confused that I am the first who recognized this bug.


0 Kudos
Highlighted
22 Views

Hello and thanks for sharing your experience here. It would be nice if you can share here the piece of code to show how do you call IPP function, to see if there are any issues with parameters order you mention.

Vladimir
0 Kudos
Highlighted
Beginner
22 Views

Here is the piece of code I could share with you:

Ipp32f xdis, ydis;
[bash]//Declaration of the needed matrix:[/bash]

int matrixSize = 7 * m_imagePointX.size();
Ipp32f matrixA[matrixSize];
Ipp32f matrixQDR[matrixSize];
Ipp32f matrixB[7] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
Ipp32f matrixC[m_imagePointX.size()];
int t;
std::cerr<<"CameraCalib::ExecuteCalib: "<
[bash]//Filling the Matrix[/bash]

for(int i=0; i {
t = i*7;
xdis = m_dxs * (m_imagePointX - m_cx);
ydis = m_dy * (m_imagePointY - m_cy);

matrixA = ydis * m_imagePointX;
matrixA[t+1] = ydis * m_refPointY;
matrixA[t+2] = ydis * m_refPointZ;
matrixA[t+3] = ydis;
matrixA[t+4] = -1 * xdis * m_refPointX;
matrixA[t+5] = -1 * xdis * m_refPointY;
matrixA[t+6] = -1 * xdis * m_refPointZ;
matrixC = xdis;
std::cerr<<"t="<<<"i="<<<"->"<<<" "<<<:ENDL> }


[bash]//calculation:[/bash]

IppStatus status;
int stride1 = 4*7;
int stride2 = 4;
int matrixHeight = m_imagePointX.size();
Ipp32f buffer[matrixHeight+1];
status = ippmQRDecomp_m_32f(&matrixA[0], stride2, stride1, &buffer[0], &matrixQDR[0], stride1, stride2, 7, matrixHeight);
if (status != ippStsNoErr)
{
std::cerr<<"ippmQRDecomp_m_32f Error Status:"<<<:ENDL> return IS::CalculationError;
}

status = ippmQRBackSubst_mv_32f(&matrixQDR[0], stride1, stride2, &buffer[0], &matrixC[0], stride2, &matrixB[0], stride2, 7, matrixHeight);
if (status != ippStsNoErr)
{
std::cerr<<"ippmQRBackSubst_mv_32f Error Status:"<<<:ENDL> return IS::CalculationError;
}
std::cerr<<"Erfolg bei Berechnung:"<<<:ENDL>
0 Kudos