opencv3.0 - when using solvePnP function in OPENCV 3.0 -


what wanna 4 vertice pixel points(2d coordinate) of qr-code,

and input both them , world-3d-coordination of qr-code parameter of function, solvepnp.

but when compile, solvepnp doesn't work! error occurred this..

assertion failed (npoints >= 0 && npoints == std::max(ipoints.checkvector(2, cv_32f), ipoints,checkvector(2, cv_64f))) in cv::solvepnp

in solvepnp, declared can use std::vector type, or cv::mat type, tried change both of date types. still can't..

my source code below,

***point3d pt[4]; pt[0] = point3d(0, 0, 0); pt[1] = point3d(0, 178, 0); pt[2] = point3d(178, 178, 0); pt[3] = point3d(178, 0, 0); vector<point3f> objectpoints; (int = 0; < 4; i++)     objectpoints.push_back(pt[i]);  // 3d world coordinates point2d point[4];*** 

and after procedure, got 4 vertices coordinates point[] qr code. , next is,

vector<point2f> imagepoints;     (int = 0; < 4; i++)         imagepoints.push_back(point[i]);    // 2d image coordinates       //mat objpts(4, 1, cv_64f, pt);     //mat imgpts(4, 1, cv_64f, point);      // camera parameters     double intrinsic[] = { fx, 0, cx, 0, fy, cy, 0, 0, 1 };     mat camera_matrix(3, 3, cv_64fc1, intrinsic);      double distort[] = { k1, k2, p1, p2 };     mat distortcoeffs(4, 1, cv_64fc1, distort);      // estimate camera pose     mat rvec, tvec; // rotation & translation vectors      solvepnp(objectpoints, imagepoints, camera_matrix, distortcoeffs, rvec, tvec); 

please help!

in code, array "point/pt" of point2d, "objectpoints/imagepoints" vector of point2f.

by way, different documentation, seems solvepnp function requires object points , image points in format of vector or cv::mat(n*2/3). tried using cv::mat(2/3*n) input, same error of assertion failure appears.

you may follow official example debug. locates in /samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -