Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::MatEXpr?

I am trying to multply a Mat by another mat:

cv::Mat cameraMatrix(3, 3, CV_32F);
            cameraMatrix.at<float>(0, 0) =  fx;
            cameraMatrix.at<float>(0, 1) = 0;
            cameraMatrix.at<float>(0, 2) = cx;
            cameraMatrix.at<float>(1, 0) = 0;
            cameraMatrix.at<float>(1, 1) = fy;
            cameraMatrix.at<float>(1, 2) = cy;
            cameraMatrix.at<float>(2, 0) = 0;
            cameraMatrix.at<float>(2, 1) = 0;
            cameraMatrix.at<float>(2, 2) = 1;

for (int w = 0; w < Keypoints.size(); ++w)
    {
        cv::Matx31f hom_pt(Keypoints[w].pt.x, Keypoints[w].pt.y, 1);
        hom_pt = cameraMatrixLeft.inv()*hom_pt; 

}

and am getting an error on the cameraMatrixLeft.inv()*hom_pt;

Error   6   error C2678: binary '*' : no operator found which takes a left-hand operand of type 'cv::MatExpr' (or there is no acceptable conversion)

Do i need to use a different kind of Mat for the cameraMatrix? Why is this failing?

thanks!

cv::MatEXpr?

I am trying to multply a Mat by another mat:

cv::Mat cameraMatrix(3, 3, CV_32F);
            cameraMatrix.at<float>(0, 0) =  fx;
            cameraMatrix.at<float>(0, 1) = 0;
            cameraMatrix.at<float>(0, 2) = cx;
            cameraMatrix.at<float>(1, 0) = 0;
            cameraMatrix.at<float>(1, 1) = fy;
            cameraMatrix.at<float>(1, 2) = cy;
            cameraMatrix.at<float>(2, 0) = 0;
            cameraMatrix.at<float>(2, 1) = 0;
            cameraMatrix.at<float>(2, 2) = 1;

for (int w = 0; w < Keypoints.size(); ++w)
    {
        cv::Matx31f hom_pt(Keypoints[w].pt.x, Keypoints[w].pt.y, 1);
        hom_pt = cameraMatrixLeft.inv()*hom_pt; cameraMatrix.inv()*hom_pt; 

}

and am getting an error on the cameraMatrixLeft.inv()*hom_pt;cameraMatrix.inv()*hom_pt;

Error   6   error C2678: binary '*' : no operator found which takes a left-hand operand of type 'cv::MatExpr' (or there is no acceptable conversion)

Do i need to use a different kind of Mat for the cameraMatrix? Why is this failing?

thanks!