0
我想將cvProjectPoints2的簡單代碼轉換爲C++,所以我使用cv :: ProjectPoints。我using
的cv
命名空間,以避免一切前綴與cv::
將projectPoints從C轉換爲C++
Mat_<double>* object_points = new Mat_<double>(10, 3, CV_64FC1);
Mat_<double>* rotation_vector = new Mat_<double>(3,3, CV_64FC1);
Mat_<double>* translation_vector = new Mat_<double>(Size(3,1), CV_64FC1);
Mat_<double>* intrinsic_matrix = new Mat_<double>(Size(3, 3), CV_64FC1);
vector<Point2f>* image_points = new vector<Point2f>;
double t[] = {
70, 95, 120
};
double object[] = {
150, 200, 400,
0,0,0,
0,0,0,
0,0,0,
0,0,0,
0,0,0,
0,0,0,
0,0,0,
0,0,0,
0,0,0
};
double rotation[] = {
0, 1, 0,
-1, 0, 0,
0, 0, 1
};
double intrinsic[] = {
-500, 0, 320,
0, -500, 240,
0, 0, 1
};
int main() {
for (int i = 0; i < 30; i++) {
(*object_points)[i/3][i%3] = object[i];
}
for (int i = 0; i < 9; i++) {
(*rotation_vector)[i/3][i%3] = rotation[i];
(*intrinsic_matrix)[i/3][i%3] = intrinsic[i];
}
for (int i = 0; i < 3; i++) {
(*translation_vector)[0][i] = t[i];
}
projectPoints(
object_points,
rotation_vector,
translation_vector,
intrinsic_matrix,
0,
image_points
);
}
這根本不會編譯。 projectPoints
的參數有什麼問題?
而錯誤信息是...? – 2011-05-07 22:49:16