Error in running the Prespective transform in Fedora [closed]
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?
just saying, opencv2.3.1 is pretty outdated, and should no more be used.
I tried updating it using yum install opencv. but it says already installed and upto date.
that probably only means, that yum can't install something more recent than 2.3.1 (bummer)
remember, that current stable version is 2.4.10 (or 11?), so, for that system you probably will have to build from src.
You are correct @berak searched for opencv package in rpmfind.net. I am using fedora 17 which supports upto opencv 2.3.1. only.