opencv_contrib: Bug in sfm or data incorrect ?
Hi,
I am able to use sfm module on windows. I can run all examples. But I have got a problem using reconstruct function. I have got this exception
OpenCV Error: Assertion failed (data && dims <= 2 && (rows == 1 || cols == 1) && rows + cols - 1 == n && channels() == 1) in cv::Mat::operator class cv::Vec<double,2>, file G:\Lib\opencv\modules\core\include\opencv2/core/mat.inl.hpp, line 1221
I think you can reproduce using this code :
vector<Mat> pt2d;
pt2d.push_back((Mat_<double>(1, 16) << 64., 298., 560., 405., 271., 298., 514., 417., 651., 435., 561, 373., 497., 369., 350., 241));
pt2d.push_back((Mat_<double>(1,16)<< 62., 272., 5.1840002441406250e+02, 4.1817602539062500e+02, 268.,266., 513., 359., 649., 371., 559., 227., 495., 229., 346., 205.));
pt2d.push_back((Mat_<double>(1, 16) << 362., 185., 650., 304., 160., 248., 364., 192., 78., 146., 357.,176., 247., 402., 76., 149));
pt2d.push_back((Mat_<double>(1, 16) << 668., 296., 5.9040000915527344e+01, 3.8880001831054688e+02,6.5520001220703125e+02, 2.6496002197265625e+02,
4.9447909545898438e+02, 2.9382092285156250e+02,4.6800003051757813e+01, 9.9600006103515625e+01,5.1120001220703125e+02, 4.1280001831054688e+02,
1.3080000305175781e+02, 2.4600001525878906e+02,2.6873861694335938e+02, 1.1197442626953125e+02 ));
for (int i=0;i<pt2d.size();i++)
pt2d[i]= pt2d[i].reshape(2);
vector<Mat> Rs_est, ts_est, points3d_estimated
Mat K = (cv::Mat_<float>(3, 3) << 350, 0, 240, 0, 350, 360, 0, 0, 1);
reconstruct(pt2d, Rs_est, points3d_estimated, K, true);
In debugging problem is here and should be something like points2d[frame].col(track).at<Vec2d>(0)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 21 (14 by maintainers)
Sorry, is this still considered a bug?
It happens to me even when I simply copy the code from this official tutorial…
P.S. I'm running everything on a docker container with this
Dockerfile
: