开发者

How to mix OpenCV 1.0 and OpenCV 2.0

开发者 https://www.devze.com 2023-04-08 05:35 出处:网络
I want to do a polar transform. But in OpenCV 2.0 there doesn\'t appear to be a C++ version of the cvLogPolar function. How do I use it with cv::Mat?

I want to do a polar transform. But in OpenCV 2.0 there doesn't appear to be a C++ version of the cvLogPolar function. How do I use it with cv::Mat?

Error: 'cvLogPolar' : cannot convert parameter 1 from 'cv::Mat' to 'const CvArr *'

Here is my code:

VideoCapture开发者_开发技巧 cap(1);
try {
    if(!cap.isOpened()) {
        throw "Could not open capture device";
    }
} catch(char* e) {
    cerr << "Error: " << e << endl;
}

for(;;) {
    Mat frame;
    cap >> frame;
    cvLogPolar(frame, frame, Point(frame.size().width/2, frame.size().height/2),
        1.0f, CV_INTER_LINEAR|CV_WARP_INVERSE_MAP);
    imshow("Preview", frame);
    if(waitKey(30) >= 0) break;
}

Tear it apart, I need to learn something anyway.


Try something like

Mat frame;
cap >> frame;

Mat dst(frame.size(), frame.type());
CvMat cvframe = frame;
CvMat cvdst = dst;
cvLogPolar(&cvframe, &cvdst, Point(frame.size().width/2, frame.size().height/2),
    1.0f, CV_INTER_LINEAR|CV_WARP_INVERSE_MAP);
imshow("Preview", dst);

I've created new Mat to store results of cvLogPolar because this function can not operate in-place.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号