1

I'm unfortunately struggling with this. I have a project that is mixed with Emgu and OpenCvSharp. Sounds odd but there are reasons.

At any rate, what I have is an EMGU.CV.Image that I'd like to use to populate an OpenCvSharp IplImage

I'm assuming this is possible, however I cannot wrap my head around it.

Relevant snippet of code (C#):

            FrameCapture = Cv.CreateFileCapture(@"C:\test\vid1.mp4");

            var frm = cap.QueryFrame();
            var frameBmp = frm.Bitmap;

            IplImage curFrame = ??? <<====== I'd like to create curFrame based on frameBmp
4

1 回答 1

1

像往常一样,答案总是很简单。

对于遇到此问题的任何人,您可以执行以下操作:

            var frm = cap.QueryFrame(); // this is an Emgu.CV.Image object
            var frameBmp = frm.Bitmap; // this is the bitmap from that object

            Frame = new IplImage(frameBmp.Width, frameBmp.Height, BitDepth.U8, 3);  //creates the OpenCvSharp IplImage;
            Frame.CopyFrom(frameBmp); // copies the bitmap data to the IplImage
于 2014-08-20T21:18:05.170 回答