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. Any ideas? I'm new to C#, so any suggestion is welcome.
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.
In the year 2020 version 4.2 you can use:
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 ). That gave me some headache in the beginning.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.