Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SVD Compute returns matrix with 0 dimension

Hello. Here is an odd problem, and i would be grateful for any advice.

Code...

cv::Mat x1Tx2 = cv::Mat::zeros(2,2, CV_64FC1 ); cv::Mat UT = cv::Mat::zeros(2,2, CV_64FC1 ); cv::Mat V = cv::Mat::zeros(2,2, CV_64FC1 ); cv::Mat tempW = cv::Mat::zeros(2,2, CV_64FC1 ); cv::Mat VUT = cv::Mat::zeros(2,2, CV_64FC1 );

//Some code ...

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl; cv::SVD::compute(x1Tx2, tempW, UT, V,CV_SVD_U_T); cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

Output [2 x 2] [2 x 2][2 x 2] [2 x 2] [1 x 2] [2 x 0][2 x 0] [2 x 2]

Clearly the SVD function has changed the size of the cv::Mat which results in unusable matrices with 0 size dimensions. Any clues?

SVD Compute returns matrix with 0 dimension

Hello. Here is an odd problem, and i would be grateful for any advice.advice for this simple use case of svd.

Code...

cv::Mat x1Tx2 = cv::Mat::zeros(2,2, CV_64FC1 ); );

cv::Mat UT = cv::Mat::zeros(2,2, CV_64FC1 ); );

cv::Mat V = cv::Mat::zeros(2,2, CV_64FC1 ); );

cv::Mat tempW = cv::Mat::zeros(2,2, CV_64FC1 ); );

cv::Mat VUT = cv::Mat::zeros(2,2, CV_64FC1 );

//Some code ...

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl; endl;

cv::SVD::compute(x1Tx2, tempW, UT, V,CV_SVD_U_T); V,CV_SVD_U_T);

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

Output Output

[2 x 2] [2 x 2][2 x 2] [2 x 2] 2]

[1 x 2] [2 x 0][2 x 0] [2 x 2]

Clearly the SVD function has changed the size of the cv::Mat which results in unusable matrices with 0 size dimensions. Any clues?

SVD Compute returns matrix with 0 dimension

Hello. Here is an odd problem, and i would be grateful for any advice for this simple use case of svd.

Code...

cv::Mat x1Tx2 = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat UT = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat V = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat tempW = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat VUT = cv::Mat::zeros(2,2, CV_64FC1 );

//Some code ...... !!! EVEN IF THIS IS REMOVED ISSUE STILL OCCURS !!!

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

cv::SVD::compute(x1Tx2, tempW, UT, V,CV_SVD_U_T);

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

Output

[2 x 2] [2 x 2][2 x 2] [2 x 2]

[1 x 2] [2 x 0][2 x 0] [2 x 2]

Clearly the SVD function has changed the size of the cv::Mat which results in unusable matrices with 0 size dimensions. Any clues?

SVD Compute returns matrix with 0 dimension

Hello. Here is an odd problem, and i would be grateful for any advice for this simple use case of svd.

Code...

cv::Mat x1Tx2 = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat UT = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat V = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat tempW = cv::Mat::zeros(2,2, CV_64FC1 );

cv::Mat VUT = cv::Mat::zeros(2,2, CV_64FC1 );

//Some code ... !!! EVEN IF THIS IS REMOVED ISSUE STILL OCCURS !!!

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

cv::SVD::compute(x1Tx2, tempW, UT, V,CV_SVD_U_T);

cout << tempW.size() << " " << V.size() << "" << UT.size() << " " << VUT.size() << endl;

Output

[2 x 2] [2 x 2][2 x 2] [2 x 2]

[1 x 2] [2 x 0][2 x 0] [2 x 2]

Clearly the SVD function has changed the size of the cv::Mat which results in unusable matrices with 0 size dimensions. Any clues?

If cv::Mat not initialised, then svd produces.... [1 x 2] [0 x 0][0 x 0] [0 x 0]