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 "precomp.hpp"
#include <complex>
namespace cv 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[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]; 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); solvePoly(coeffs, roots);
std::vector<double> xs, ys, zs; std::vector<double> xs, ys, zs;
@ -111,8 +110,8 @@ public:
double* e = ematrix.ptr<double>(); double* e = ematrix.ptr<double>();
for (size_t i = 0; i < roots.size(); i++) for (size_t i = 0; i < roots.size(); i++)
{ {
if (fabs(roots[i].imag()) > 1e-10) continue; if (fabs(roots[i].im) > 1e-10) continue;
double z1 = roots[i].real(); double z1 = roots[i].re;
double z2 = z1 * z1; double z2 = z1 * z1;
double z3 = z2 * z1; double z3 = z2 * z1;
double z4 = z3 * z1; double z4 = z3 * z1;

View File

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

View File

@ -52,10 +52,6 @@
#include <cfloat> #include <cfloat>
#include <vector> #include <vector>
#ifndef OPENCV_NOSTL
# include <complex>
#endif
#include "opencv2/core/cvdef.h" #include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp" #include "opencv2/core/cvstd.hpp"
#include "opencv2/core/matx.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: case C2C:
inLayout = CLFFT_COMPLEX_INTERLEAVED; inLayout = CLFFT_COMPLEX_INTERLEAVED;
outLayout = 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]; clStridesOut[1] = clStridesIn[1];
break; break;
case R2C: case R2C:
inLayout = CLFFT_REAL; inLayout = CLFFT_REAL;
outLayout = CLFFT_HERMITIAN_INTERLEAVED; outLayout = CLFFT_HERMITIAN_INTERLEAVED;
clStridesIn[1] = src_step / sizeof(float); clStridesIn[1] = src_step / sizeof(float);
clStridesOut[1] = dst_step / sizeof(std::complex<float>); clStridesOut[1] = dst_step / (2*sizeof(float));
break; break;
case C2R: case C2R:
inLayout = CLFFT_HERMITIAN_INTERLEAVED; inLayout = CLFFT_HERMITIAN_INTERLEAVED;
outLayout = CLFFT_REAL; outLayout = CLFFT_REAL;
clStridesIn[1] = src_step / sizeof(std::complex<float>); clStridesIn[1] = src_step / (2*sizeof(float));
clStridesOut[1] = dst_step / sizeof(float); clStridesOut[1] = dst_step / sizeof(float);
break; break;
default: default:

View File

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