Ask Your Question
9

Any way to convert IplImage* to cv::Mat in OpenCV 3.0.0?

asked Nov 1 '13

Jose Luis Blanco gravatar image

updated Nov 1 '13

Hi,

I'm having problems porting some legacy code to OpenCV 3.X (git master), because can't find any replacement for this kind of conversions:

    IplImage * ipl1, *ipl2;
    // ...
    const cv::Mat m = cv::Mat(ipl,false);  // Fails 
    cv::Mat  m2 = ipl2;  // Fails

Have all those constructors been removed from the new OpenCV 3.X for some reason? Are there any alternatives?

Thanks.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
16

answered Nov 3 '13

Jose Luis Blanco gravatar image

For the records: taking a look at core/src/matrix.cpp it seems that, indeed, the constructor cv::Mat(IplImage*) has disappeared.

But I found this alternative:

    IplImage * ipl = ...;
    cv::Mat m = cv::cvarrToMat(ipl);  // default additional arguments: don't copy data.
Preview: (hide)

Question Tools

1 follower

Stats

Asked: Nov 1 '13

Seen: 42,574 times

Last updated: Nov 03 '13