swalkner
swalkner

Reputation: 17359

cvLogPolar results in opencv error "Bad flag (parameter or structure field)"

I'm trying to use the cvLogPolar method, but I always get the following error:

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /tmp/opencv-pcqRHK/opencv-2.4.10.1/modules/core/src/array.cpp, line 2482
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-pcqRHK/opencv-2.4.10.1/modules/core/src/array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat

My code:

    cv::Mat logpolar_frame(size, CV_8UC3), bgr_frame;

    for(;;) {
        capture >> bgr_frame;
        if( bgr_frame.empty() ) {
            break;
        }

        cv::imshow( "Example2_10", bgr_frame );

        cvLogPolar(&bgr_frame, &logpolar_frame, cv::Point2f(bgr_frame.cols / 2, bgr_frame.rows / 2), 40);
    }

I already tried to copy the bgr_frame inside the loop, but this results in the same error.

Upvotes: 1

Views: 619

Answers (1)

berak
berak

Reputation: 39806

you need a bloody IplImage* for the arcane c-api legacy functions.

IplImage ipl_in = bgr_frame;
IplImage ipl_out = logpolar_frame;

cvLogPolar(&ipl_in, &ipl_out, ...)

(for 3.0, avoid all of it, and use cv::logPolar(), unfortunately not available in opencv2.4)

Upvotes: 4

Related Questions