Merge pull request #547 from vpisarev:fixes_244
This commit is contained in:
commit
11b83d4000
@ -1095,27 +1095,30 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
if( type == CV_32FC1 )
|
||||
{
|
||||
double d = det3(Sf);
|
||||
if( d != 0. )
|
||||
|
||||
if( fabs(d) < 1e-4 || fabs(d) > 1e4 )
|
||||
result = invert(src, dst, DECOMP_SVD) > 0;
|
||||
else
|
||||
{
|
||||
double t[12];
|
||||
|
||||
float t[12];
|
||||
float df = (float)(1./d);
|
||||
result = true;
|
||||
d = 1./d;
|
||||
t[0] = (((double)Sf(1,1) * Sf(2,2) - (double)Sf(1,2) * Sf(2,1)) * d);
|
||||
t[1] = (((double)Sf(0,2) * Sf(2,1) - (double)Sf(0,1) * Sf(2,2)) * d);
|
||||
t[2] = (((double)Sf(0,1) * Sf(1,2) - (double)Sf(0,2) * Sf(1,1)) * d);
|
||||
|
||||
t[3] = (((double)Sf(1,2) * Sf(2,0) - (double)Sf(1,0) * Sf(2,2)) * d);
|
||||
t[4] = (((double)Sf(0,0) * Sf(2,2) - (double)Sf(0,2) * Sf(2,0)) * d);
|
||||
t[5] = (((double)Sf(0,2) * Sf(1,0) - (double)Sf(0,0) * Sf(1,2)) * d);
|
||||
t[0] = (Sf(1,1) * Sf(2,2) - Sf(1,2) * Sf(2,1)) * df;
|
||||
t[1] = (Sf(0,2) * Sf(2,1) - Sf(0,1) * Sf(2,2)) * df;
|
||||
t[2] = (Sf(0,1) * Sf(1,2) - Sf(0,2) * Sf(1,1)) * df;
|
||||
|
||||
t[6] = (((double)Sf(1,0) * Sf(2,1) - (double)Sf(1,1) * Sf(2,0)) * d);
|
||||
t[7] = (((double)Sf(0,1) * Sf(2,0) - (double)Sf(0,0) * Sf(2,1)) * d);
|
||||
t[8] = (((double)Sf(0,0) * Sf(1,1) - (double)Sf(0,1) * Sf(1,0)) * d);
|
||||
t[3] = (Sf(1,2) * Sf(2,0) - Sf(1,0) * Sf(2,2)) * df;
|
||||
t[4] = (Sf(0,0) * Sf(2,2) - Sf(0,2) * Sf(2,0)) * df;
|
||||
t[5] = (Sf(0,2) * Sf(1,0) - Sf(0,0) * Sf(1,2)) * df;
|
||||
|
||||
Df(0,0) = (float)t[0]; Df(0,1) = (float)t[1]; Df(0,2) = (float)t[2];
|
||||
Df(1,0) = (float)t[3]; Df(1,1) = (float)t[4]; Df(1,2) = (float)t[5];
|
||||
Df(2,0) = (float)t[6]; Df(2,1) = (float)t[7]; Df(2,2) = (float)t[8];
|
||||
t[6] = (Sf(1,0) * Sf(2,1) - Sf(1,1) * Sf(2,0)) * df;
|
||||
t[7] = (Sf(0,1) * Sf(2,0) - Sf(0,0) * Sf(2,1)) * df;
|
||||
t[8] = (Sf(0,0) * Sf(1,1) - Sf(0,1) * Sf(1,0)) * df;
|
||||
|
||||
Df(0,0) = t[0]; Df(0,1) = t[1]; Df(0,2) = t[2];
|
||||
Df(1,0) = t[3]; Df(1,1) = t[4]; Df(1,2) = t[5];
|
||||
Df(2,0) = t[6]; Df(2,1) = t[7]; Df(2,2) = t[8];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -419,7 +419,9 @@ static void fixCCS( Mat& mat, int cols, int flags )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
{
|
||||
dst.create(src1.rows, src1.cols, src1.type());
|
||||
@ -439,8 +441,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
if( !(flags & CV_DXT_MUL_CONJ) )
|
||||
for( j = 0; j < cols; j += 2 )
|
||||
{
|
||||
double re = (double)a[j]*b[j] - (double)a[j+1]*b[j+1];
|
||||
double im = (double)a[j+1]*b[j] + (double)a[j]*b[j+1];
|
||||
double re = (double)a[j]*(double)b[j] - (double)a[j+1]*(double)b[j+1];
|
||||
double im = (double)a[j+1]*(double)b[j] + (double)a[j]*(double)b[j+1];
|
||||
|
||||
c[j] = (float)re;
|
||||
c[j+1] = (float)im;
|
||||
@ -448,8 +450,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
else
|
||||
for( j = 0; j < cols; j += 2 )
|
||||
{
|
||||
double re = (double)a[j]*b[j] + (double)a[j+1]*b[j+1];
|
||||
double im = (double)a[j+1]*b[j] - (double)a[j]*b[j+1];
|
||||
double re = (double)a[j]*(double)b[j] + (double)a[j+1]*(double)b[j+1];
|
||||
double im = (double)a[j+1]*(double)b[j] - (double)a[j]*(double)b[j+1];
|
||||
|
||||
c[j] = (float)re;
|
||||
c[j+1] = (float)im;
|
||||
@ -482,6 +484,9 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined _MSC_VER && _MSC_VER >= 1700
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user