简体   繁体   English

Emgu OpenCV Intptr 到 IplImage?

[英]Emgu OpenCV Intptr to IplImage?

I'm using the Emgu OpenCV C# wrapper, and I'm trying to convert the IntPtr(s) that its functions return and access the actual IplImage OpenCV objects.我正在使用 Emgu OpenCV C# 包装器,并且我正在尝试转换其函数返回的 IntPtr(s) 并访问实际的 IplImage OpenCV 对象。 Any ideas?有任何想法吗? I'm new to C#, so any suggestion is welcome.我是 C# 新手,欢迎提出任何建议。

Cheers.干杯。

Well, got the solution, and posting it here -好吧,得到了解决方案,并在此处发布 -

 IntPtr rgb32; 

... ...

 MIplImage rgb32Image = new MIplImage();
 rgb32Image = (MIplImage)Marshal.PtrToStructure(rgb32, typeof(MIplImage));

Where, of course, rgb32Image is what's needed.当然,需要 rgb32Image 的地方。

In the year 2020 version 4.2 you can use:在 2020 年 4.2 版中,您可以使用:

Emgu.CV.Image<TColor, TDepth>.FromIplImagePtr(System.IntPtr)

Note: Also recognize that from v4.2 on to convert a bitmap into a Image<,>, you now have to use the Bitmap extension method ToImage<,>() found in the Emgu.CV.runtime.windows Nuget package (see http://www.emgu.com/wiki/index.php/Version_History#Emgu.CV-4.2.0 ).注意:还要认识到,从 v4.2 开始,要将位图转换为 Image<,>,您现在必须使用 Emgu.CV.runtime.windows Nuget 包中的位图扩展方法 ToImage<,>()(请参阅http://www.emgu.com/wiki/index.php/Version_History#Emgu.CV-4.2.0 )。 That gave me some headache in the beginning.这让我一开始有些头疼。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM