Can't convert cv::Mat to CV_32F in ocv 3.1

asked 2016-05-13 13:49:18 -0600

joshuajnoble gravatar image

Trying to convert an image to CV_32F like so:

cv::Mat ofApp::getDescriptors(const cv::Mat& img)
{
    cv::Mat dst;
    img.convertTo(dst, CV_32F);

Gives me the following error:

OpenCV Error: The function/feature is not implemented (Unknown/unsupported array type) in create, file ../../code/opencv/opencv-3.1.0/modules/core/src/matrix.cpp, line 2559
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: ../../code/opencv/opencv-3.1.0/modules/core/src/matrix.cpp:2559: error: (-213) Unknown/unsupported array type in function create

Can someone shed some light on how to convert an image to CV_32F? The image itself is a valid cv::Mat with the following characteristics:

flags   int 1124024336
dims    int 2
rows    int 499
cols    int 381

I can draw the image without problem but can't convert it to CV_32F

edit retag flag offensive close merge delete

Comments

I don't understand what happen. This message is sent by function create at this line. This function is called by convertTo when dims>2.

Just before img.convertTo can you add :

Mat m1 = Mat::zeros(499,381,CV_8UC3);
m1.convertTo(dst, CV_32F);

and check if m1.flags is OK

LBerger gravatar imageLBerger ( 2016-05-14 02:03:17 -0600 )edit