private void CameraGrabberFrameCallback0( IntPtr Grabber, IntPtr pFrameBuffer, ref tSdkFrameHead pFrameHead, IntPtr Context) { MIplImage IpImg = (MIplImage)Marshal.PtrToStructure(pFrameBuffer, typeof(MIplImage)); //Mat mat = MIpImg. Mat mat = CvInvoke.CvArrToMat(IpImg.ImageData); captureImageBox.Image = mat; if (m_bRecording) { MvApi.CameraPushFrame(m_hCamera[0], pFrameBuffer, ref pFrameHead); } }
public virtual bool Retrieve(IOutputArray outputArray) { if (FlipType == FlipType.None) { var ptr = CvInvokeRaspiCamCV.cvQueryFrame(_ptr); using (Mat m = CvInvoke.CvArrToMat(ptr)) { m.CopyTo(outputArray); } return(true); } else { using (Mat tmp = new Mat()) { var ptr = CvInvokeRaspiCamCV.cvQueryFrame(Ptr); var managedImage = Image <Bgr, Byte> .FromIplImagePtr(ptr); managedImage.Mat.CopyTo(tmp); CvInvoke.Flip(tmp, outputArray, FlipType); return(true); } } }
protected override void DoTask() { buffer.Bytes = Color.Pixels; var scale = buffer.Resize(Color.Width / ratio, Color.Height / ratio, Emgu.CV.CvEnum.Inter.Cubic); if (select != Rectangle.Empty) { Log("Initialize ..."); current = new Rectangle(select.X / ratio, select.Y / ratio, select.Width / ratio, select.Height / ratio); debug = new Rectangle(select.X, select.Y, select.Width, select.Height); // MIL, BOOSTING, MEDIANFLOW, TLD, CMT Mat mat = CvInvoke.CvArrToMat(scale, true); tracker = new Tracker(ConfigManager.GetInstance().Find("cmt.algo", "CMT")); tracker.init(mat, current); select = Rectangle.Empty; } else if (current != Rectangle.Empty) { Mat mat = CvInvoke.CvArrToMat(scale, true); tracker.update(mat, ref current); } }