Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- Use of Least Square Method on IPP

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

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.

jeremy_74

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-02-2011
08:03 AM

22 Views

Use of Least Square Method on IPP

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]

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.

4 Replies

Highlighted
##

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

jeremy_74

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-03-2011
01:19 AM

22 Views

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.

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..

Highlighted
##

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.

jeremy_74

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-03-2011
07:01 AM

22 Views

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.

Highlighted
##

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

Vladimir_D_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-03-2011
10:14 AM

22 Views

Vladimir

Highlighted
##

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

Ipp32f xdis, ydis;

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: "<

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> }

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>

jeremy_74

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-04-2011
02:58 AM

22 Views

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

ydis = m_dy * (m_imagePointY

matrixA

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

std::cerr<<"t="<

[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:"<

}

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:"<

}

std::cerr<<"Erfolg bei Berechnung:"<

For more complete information about compiler optimizations, see our Optimization Notice.