예제 #1
0
 public ImageData(Image.CameraType camera, LEAP_IMAGE image, DistortionData distortionData)
 {
     this.camera              = camera;
     this._properties         = image.properties;
     this.DistortionMatrixKey = image.matrix_version;
     this.DistortionData      = distortionData;
     this._object             = MemoryManager.GetPinnedObject(image.data);
     this.byteOffset          = image.offset;
 }
    private DistortionData createDistortionData(LEAP_IMAGE image, Image.CameraType camera) {
      DistortionData distortionData = new DistortionData();
      distortionData.Version = image.matrix_version;
      distortionData.Width = LeapC.DistortionSize; //fixed value for now
      distortionData.Height = LeapC.DistortionSize; //fixed value for now

      //Visit LeapC.h for more details.  We need to marshal the float data manually
      //since the distortion struct cannot be represented safely in c#
      distortionData.Data = new float[(int)(distortionData.Width * distortionData.Height * 2)]; //2 float values per map point
      Marshal.Copy(image.distortionMatrix, distortionData.Data, 0, distortionData.Data.Length);

      if (LeapDistortionChange != null) {
        LeapDistortionChange.DispatchOnContext(this, EventContext, new DistortionEventArgs(distortionData, camera));
      }
      return distortionData;
    }
예제 #3
0
        private DistortionData createDistortionData(LEAP_IMAGE image, Image.CameraType camera)
        {
            DistortionData distortionData = new DistortionData();

            distortionData.Version = image.matrix_version;
            distortionData.Width   = LeapC.DistortionSize;                                               //fixed value for now
            distortionData.Height  = LeapC.DistortionSize;                                               //fixed value for now
            distortionData.Data    = new float[(int)(distortionData.Width * distortionData.Height * 2)]; //2 float values per map point
            LEAP_DISTORTION_MATRIX matrix;

            StructMarshal <LEAP_DISTORTION_MATRIX> .PtrToStruct(image.distortionMatrix, out matrix);

            Array.Copy(matrix.matrix_data, distortionData.Data, matrix.matrix_data.Length);

            if (LeapDistortionChange != null)
            {
                LeapDistortionChange.DispatchOnContext <DistortionEventArgs>(this, EventContext, new DistortionEventArgs(distortionData, camera));
            }
            return(distortionData);
        }