如何在 C NOT C++ 中将 Mat 转换为 IplImage [英] How do I convert Mat to IplImage in C NOT C++

查看:56
本文介绍了如何在 C NOT C++ 中将 Mat 转换为 IplImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一些旧的 C 代码,这些代码使用旧的已弃用的 IplImage 类型.

I'm using some old C code that uses the old deprecated IplImage type.

我正在使用适用于 Android 的新 OpenCV 2.3.1,我从相机获取的图像是 CvMat.我想将它们转换为 IplImage 以便我可以将其传递给本机函数.

I'm using the new OpenCV 2.3.1 for Android, and the images I get from the camera are CvMats. I want to convert them to IplImage so I can pass it to the native function.

或者,我可以修改原始函数以接受 CvMat 并将其转换为函数体内的 IplImage,但我需要在 C NOT 中执行此操作C++.

Alternatively, I could modify the original function to accept a CvMat and convert it to IplImage inside the body of the function, but I need to do this in C NOT C++.

推荐答案

使用 <代码>cvGetImage:

IplImage tmp;
IplImage* result = cvGetImage((CvArr*) mat, &tmp);

这篇关于如何在 C NOT C++ 中将 Mat 转换为 IplImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆