|
38 | 38 |
|
39 | 39 | #include "calc.hpp"
|
40 | 40 |
|
41 |
| -#include <opencv2/calib3d/calib3d.hpp> |
42 |
| -#include <opencv2/core/core_c.h> |
| 41 | +#include <opencv2/calib3d.hpp> |
43 | 42 |
|
44 | 43 | static void convParam(const float intr[3][4], const float dist[AR_DIST_FACTOR_NUM_MAX], const int xsize, const int ysize, const int dist_function_version, ARParam *param);
|
45 | 44 | static ARdouble getSizeFactor(ARdouble const dist_factor[AR_DIST_FACTOR_NUM_MAX], const int xsize, const int ysize, const int dist_function_version);
|
@@ -137,22 +136,22 @@ void calc(const int capturedImageNum,
|
137 | 136 | convParam(intr, dist, width, height, dist_function_version, ¶m);
|
138 | 137 | arParamDisp(¶m);
|
139 | 138 |
|
140 |
| - CvMat *rotationVector; |
141 |
| - CvMat *rotationMatrix; |
| 139 | + cv::Mat rotationVector; |
| 140 | + cv::Mat rotationMatrix; |
142 | 141 | double trans[3][4];
|
143 | 142 | ARdouble cx, cy, cz, hx, hy, h, sx, sy, ox, oy, err;
|
144 | 143 | ARdouble err_min = 1000000.0f, err_avg = 0.0f, err_max = 0.0f;
|
145 |
| - rotationVector = cvCreateMat(1, 3, CV_32FC1); |
146 |
| - rotationMatrix = cvCreateMat(3, 3, CV_32FC1); |
| 144 | + rotationVector = cv::Mat(1, 3, CV_32FC1); |
| 145 | + rotationMatrix = cv::Mat(3, 3, CV_32FC1); |
147 | 146 |
|
148 | 147 | for (k = 0; k < capturedImageNum; k++) {
|
149 | 148 | for (i = 0; i < 3; i++) {
|
150 |
| - ((float *)(rotationVector->data.ptr))[i] = (float)rotationVectors.at(k).at<double>(i); |
| 149 | + ((float *)(rotationVector.data))[i] = (float)rotationVectors.at(k).at<double>(i); |
151 | 150 | }
|
152 |
| - cvRodrigues2(rotationVector, rotationMatrix, 0); |
| 151 | + cv::Rodrigues(rotationVector, rotationMatrix); |
153 | 152 | for (j = 0; j < 3; j++) {
|
154 | 153 | for (i = 0; i < 3; i++) {
|
155 |
| - trans[j][i] = ((float *)(rotationMatrix->data.ptr + rotationMatrix->step*j))[i]; |
| 154 | + trans[j][i] = rotationMatrix.at<float>(j, i); |
156 | 155 | }
|
157 | 156 | trans[j][3] = (float)translationVectors.at(k).at<double>(j);
|
158 | 157 | }
|
@@ -192,9 +191,6 @@ void calc(const int capturedImageNum,
|
192 | 191 | *err_max_out = err_max;
|
193 | 192 |
|
194 | 193 | *param_out = param;
|
195 |
| - |
196 |
| - cvReleaseMat(&rotationVector); |
197 |
| - cvReleaseMat(&rotationMatrix); |
198 | 194 | }
|
199 | 195 |
|
200 | 196 | static void convParam(const float intr[3][4], const float dist[AR_DIST_FACTOR_NUM_MAX], const int xsize, const int ysize, const int dist_function_version, ARParam *param)
|
|
0 commit comments