Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error in running the Prespective transform in Fedora

When i run the following program it is working but when i run it in fedora it shows the error message

OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMat, file /builddir/build/BUILD/OpenCV-2.3.1/modules/core/src/matrix.cpp, line 918
terminate called after throwing an instance of 'cv::Exception'
  what():  /builddir/build/BUILD/OpenCV-2.3.1/modules/core/src/matrix.cpp:918: error: (-215) k == STD_VECTOR_MAT in function getMat

Mainly this error is thrown when the getPerspectiveTransform(P,Q); is included.

the code is

#include "opencv2/opencv.hpp"   
using namespace cv;

int main() 
{
    Mat ocv = imread("chess.png");

    vector<Point2f> P,Q;
   P.push_back(Point2f(118,128));
    Q.push_back(Point2f(10,10)); // 10 pixel border on all sides

    P.push_back(Point2f(753,19));
    Q.push_back(Point2f(210,10));

    P.push_back(Point2f(625,328));
    Q.push_back(Point2f(210,210));

    P.push_back(Point2f(18,542));
    Q.push_back(Point2f(10,210));

    Mat rot = cv::getPerspectiveTransform(P,Q);

    Mat result;
    cv::warpPerspective(ocv, result, rot, Size(220,220));

    imshow("result",result);
    waitKey();
    return 0;
}

Why this error occoured?