well, those functions in calib3d are a bit inconsistent, whether to use N channels or N rows to store the data, if you work longer with that, i''ll promise you more "fun" like that xD. (and obviously, trying with 5 year old code does not really help..)
let's shorten the problem:
cv::Mat P(3,4,cv::DataType<double>::type);
// Decompose the projection matrix into:
cv::Mat K,rvec,Thomogeneous; /// but let opencv decide the type/shape !
cv::decomposeProjectionMatrix(P, K, rvec, Thomogeneous);
//
// now, Thomogeneous is a Mat(4,1,CV_64F),
// but the next function requires Mat(1,1,CV_64FC4) ;
// so we're going to reshape it, to 4 channels, and a single row.
// also, let's be more explicit, about which direction this is going (4->3)
// (and use ...FromHomogeneous())
//
cv::Mat T;
cv::convertPointsFromHomogeneous(Thomogeneous.reshape(4,1), T);
// T will be Mat(1,1,CV_64FC3), now.
// if you need it as Mat(3,1,CV64F) later on (and you probably will !),
// do the reverse reshape:
// T = T.reshape(1,3); // 3 rows, 1 channel
we can't help without seing your code .. ;)
Hello Berak,
Thank you for the quick response, BTW am running project points example program provided in the below link. https://github.com/daviddoria/Example...
Kindly suggest me the possible solution, I am eagerly looking for that.
Thanks in Advance
that's 5 year old, unmaintained opencv2.4 code ;(
Hello Berak,
Could u please suggest me any reference code block to understand pointprojection routine in Open CV.