I want to transform a polar grid image into a cartesian representation. But I keep have a strange error message that says:
OpenCV Error : Bad flag(parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file M : \libs\OpenCV - 2.4.13x86\sources\modules\core\src\array.cpp, line 2482
Here is my code that i kept as simple as possible:
#include<cstdio>
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc.hpp"
int main()
{
// cv::Mat src = cv::imread("savetest.png"); // _lin_polar_img
// cv::Mat src = cv::imread("280px_1.png"); // _lin_polar_img
cv::Mat src = cv::Mat(800, 800, CV_8SC3); // _lin_polar_img
cv::Mat _recovered_cart_img;
cv::Point2f center( (float)src.cols / 2.f, (float)src.rows / 2.f );
double maxRadius = 0.7*std::min(center.y, center.x);
// cvLinearPolar(const CvArr* src, CvArr* dst, CvPoint2D32f center, double maxRadius, int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS )
cvLinearPolar(&src, &_recovered_cart_img, center, maxRadius, cv::INTER_LINEAR+CV_WARP_INVERSE_MAP);
system("pause");
return 0;
}
I am using OpenCV 2.4.13 on windows 10 (VisualC++ 2015).