Ask Your Question
9

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

asked 2013-11-01 07:28:57 -0600

Jose Luis Blanco gravatar image

updated 2013-11-01 14:54:15 -0600

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
16

answered 2013-11-03 09:19:07 -0600

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.
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-11-01 07:28:57 -0600

Seen: 42,482 times

Last updated: Nov 03 '13