cv::MatEXpr?

asked 2015-06-22 10:28:36 -0600

stillNovice gravatar image

updated 2015-06-22 10:52:31 -0600

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 = cameraMatrix.inv()*hom_pt; 

}

and am getting an error on the 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!

edit retag flag offensive close merge delete

Comments

cameraMatrixLeft where is defined?

zugo gravatar imagezugo ( 2015-06-22 10:43:25 -0600 )edit
1

why not use a Matx33f for the cameraMatrix ? you could intialize it as easy as:

Matx33f CM(fx,0,cx,0,fy,cy,0,0,1);
hom_pt = CM.inv() * hom_pt;
berak gravatar imageberak ( 2015-06-22 10:46:46 -0600 )edit

cameraMatrixLeft was a mistake! fixed in question.

stillNovice gravatar imagestillNovice ( 2015-06-22 10:56:22 -0600 )edit
1

Matx33f works like a dream. Thanks berak!

stillNovice gravatar imagestillNovice ( 2015-06-22 10:56:39 -0600 )edit