2011-02-14 5 views

답변

2

는 발견 :

  GCHandle handle = GCHandle.Alloc(dataArray, GCHandleType.Pinned); 
      IntPtr imageHeaderForBytes = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MIplImage))); 
      CvInvoke.cvInitImageHeader(
        imageHeaderForBytes, 
        new Size(160, 120), 
        Emgu.CV.CvEnum.IPL_DEPTH.IPL_DEPTH_16S, 1, 0, 4); 
      Marshal.WriteIntPtr(
        imageHeaderForBytes, 
        (int)Marshal.OffsetOf(typeof(MIplImage), "imageData"), 
        handle.AddrOfPinnedObject()); 

      CvInvoke.cvCopy(imageHeaderForBytes, EMGUImage.Ptr, IntPtr.Zero); 

      Marshal.FreeHGlobal(imageHeaderForBytes); 
      handle.Free(); 
관련 문제