Fix findEssentialMat function

Also remove all usages of std::complex from OpenCV modules
This commit is contained in:
Andrey Kamaev 2013-04-03 17:25:00 +04:00
parent 6ce050d264
commit d4bb421ce2
5 changed files with 19 additions and 23 deletions

View File

@ -30,7 +30,6 @@
*/
#include "precomp.hpp"
#include <complex>
namespace cv
{
@ -101,7 +100,7 @@ public:
c[1] = (b[29]*b[7]*b[24]-b[29]*b[20]*b[11]+b[2]*b[20]*b[38]-b[2]*b[25]*b[33]-b[28]*b[20]*b[12]+b[28]*b[7]*b[25]-b[29]*b[19]*b[12]-b[3]*b[24]*b[33]+b[15]*b[33]*b[12]+b[3]*b[19]*b[38]-b[16]*b[6]*b[38]+b[3]*b[20]*b[37]+b[16]*b[32]*b[12]+b[29]*b[6]*b[25]-b[16]*b[7]*b[37]-b[3]*b[25]*b[32]-b[15]*b[7]*b[38]+b[16]*b[33]*b[11]);
c[0] = -b[29]*b[20]*b[12]+b[29]*b[7]*b[25]+b[16]*b[33]*b[12]-b[16]*b[7]*b[38]+b[3]*b[20]*b[38]-b[3]*b[25]*b[33];
std::vector<std::complex<double> > roots;
std::vector<Complex<double> > roots;
solvePoly(coeffs, roots);
std::vector<double> xs, ys, zs;
@ -111,8 +110,8 @@ public:
double* e = ematrix.ptr<double>();
for (size_t i = 0; i < roots.size(); i++)
{
if (fabs(roots[i].imag()) > 1e-10) continue;
double z1 = roots[i].real();
if (fabs(roots[i].im) > 1e-10) continue;
double z1 = roots[i].re;
double z2 = z1 * z1;
double z3 = z2 * z1;
double z4 = z3 * z1;

View File

@ -45,6 +45,7 @@
#define __OPENCV_CORE_CVSTDINL_HPP__
#ifndef OPENCV_NOSTL
# include <complex>
# include <ostream>
#endif

View File

@ -52,10 +52,6 @@
#include <cfloat>
#include <vector>
#ifndef OPENCV_NOSTL
# include <complex>
#endif
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/matx.hpp"

View File

@ -180,19 +180,19 @@ cv::ocl::FftPlan::FftPlan(Size _dft_size, int _src_step, int _dst_step, int _fla
case C2C:
inLayout = CLFFT_COMPLEX_INTERLEAVED;
outLayout = CLFFT_COMPLEX_INTERLEAVED;
clStridesIn[1] = src_step / sizeof(std::complex<float>);
clStridesIn[1] = src_step / (2*sizeof(float));
clStridesOut[1] = clStridesIn[1];
break;
case R2C:
inLayout = CLFFT_REAL;
outLayout = CLFFT_HERMITIAN_INTERLEAVED;
clStridesIn[1] = src_step / sizeof(float);
clStridesOut[1] = dst_step / sizeof(std::complex<float>);
clStridesOut[1] = dst_step / (2*sizeof(float));
break;
case C2R:
inLayout = CLFFT_HERMITIAN_INTERLEAVED;
outLayout = CLFFT_REAL;
clStridesIn[1] = src_step / sizeof(std::complex<float>);
clStridesIn[1] = src_step / (2*sizeof(float));
clStridesOut[1] = dst_step / sizeof(float);
break;
default:

View File

@ -121,12 +121,12 @@ void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
break;
case CV_32FC2:
{
lda /= sizeof(std::complex<float>);
ldb /= sizeof(std::complex<float>);
ldc /= sizeof(std::complex<float>);
offa /= sizeof(std::complex<float>);
offb /= sizeof(std::complex<float>);
offc /= sizeof(std::complex<float>);
lda /= (2*sizeof(float));
ldb /= (2*sizeof(float));
ldc /= (2*sizeof(float));
offa /= (2*sizeof(float));
offb /= (2*sizeof(float));
offc /= (2*sizeof(float));
cl_float2 alpha_2 = {{alpha, 0}};
cl_float2 beta_2 = {{beta, 0}};
openCLSafeCall
@ -139,12 +139,12 @@ void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
break;
case CV_64FC2:
{
lda /= sizeof(std::complex<double>);
ldb /= sizeof(std::complex<double>);
ldc /= sizeof(std::complex<double>);
offa /= sizeof(std::complex<double>);
offb /= sizeof(std::complex<double>);
offc /= sizeof(std::complex<double>);
lda /= (2*sizeof(double));
ldb /= (2*sizeof(double));
ldc /= (2*sizeof(double));
offa /= (2*sizeof(double));
offb /= (2*sizeof(double));
offc /= (2*sizeof(double));
cl_double2 alpha_2 = {{alpha, 0}};
cl_double2 beta_2 = {{beta, 0}};
openCLSafeCall