Esempio n. 1
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal new static FlannBasedMatcher FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<FlannBasedMatcher> pointer");
     var ptrObj = new Ptr<FlannBasedMatcher>(ptr);
     return new FlannBasedMatcher(ptrObj);
 }
Esempio n. 2
0
        /// <summary>
        /// リソースの解放
        /// </summary>
        /// <param name="disposing">
        /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。
        /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。
        ///</param>
#else
        /// <summary>
        /// Releases the resources
        /// </summary>
        /// <param name="disposing">
        /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.
        /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </param>
#endif
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    // releases managed resources
                    if (disposing)
                    {
                        if (detectorPtr != null)
                        {
                            detectorPtr.Dispose();
                            detectorPtr = null;
                        }
                    }
                    // releases unmanaged resources
                    
                    ptr = IntPtr.Zero;
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }
    /// <summary>
    /// リソースの解放
    /// </summary>
    /// <param name="disposing">
    /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。
    /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。
    ///</param>
#else
        /// <summary>
        /// Releases the resources
        /// </summary>
        /// <param name="disposing">
        /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.
        /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </param>
#endif
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    // releases managed resources
                    if (disposing)
                    {
                        if (ptrObj != null)
                        {
                            ptrObj.Dispose();
                            ptrObj = null;
                        }
                    }
                    // releases unmanaged resources
                    
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }
        private Ptr<RPC_SERVER_INTERFACE> Configure(RpcHandle handle, Ptr<MIDL_SERVER_INFO> me, Guid iid,
                                                    Byte[] formatTypes, Byte[] formatProc, ushort[] formatProcOffsets,
                                                    Delegate[] funcs)
        {
            Ptr<RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(new RPC_SERVER_INTERFACE(handle, me, iid));
            Ptr<MIDL_STUB_DESC> stub = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true));
            pStubDesc = stub.Handle;

            var dispatches = new IntPtr[funcs.Length];
            for (var i = 0; i < funcs.Length; ++i)
            {
              dispatches[i] = handle.PinFunction(funcs[i]);
            }
            DispatchTable = handle.Pin(dispatches);

            ProcString = handle.Pin(formatProc);
            FmtStringOffset = handle.Pin(formatProcOffsets.Clone());

            ThunkTable = IntPtr.Zero;
            pTransferSyntax = IntPtr.Zero;
            nCount = IntPtr.Zero;
            pSyntaxInfo = IntPtr.Zero;

            //Copy us back into the pinned address
            Marshal.StructureToPtr(this, me.Handle, false);
            return svrIface;
        }
Esempio n. 5
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static new BRISK FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<BRISK> pointer");
     var ptrObj = new Ptr<BRISK>(ptr);
     return new BRISK(ptrObj);
 }
Esempio n. 6
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static new StarDetector FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<StarDetector> pointer");
     var ptrObj = new Ptr<StarDetector>(ptr);
     return new StarDetector(ptrObj);
 }
Esempio n. 7
0
    /// <summary>
    /// リソースの解放
    /// </summary>
    /// <param name="disposing">
    /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。
    /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。
    ///</param>
#else
        /// <summary>
        /// Releases the resources
        /// </summary>
        /// <param name="disposing">
        /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.
        /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </param>
#endif
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    // releases managed resources
                    if (disposing)
                    {
                    }
                    // releases unmanaged resources
                    if (IsEnabledDispose)
                    {
                        ptrObj?.Dispose();
                        ptrObj = null;
                        ptr = IntPtr.Zero;
                    }
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }
    /// <summary>
    /// リソースの解放
    /// </summary>
    /// <param name="disposing">
    /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。
    /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。
    ///</param>
#else
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">
        /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.
        /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </param>
#endif
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    if (disposing)
                    {
                    }
                    if (IsEnabledDispose)
                    {
                        if (objectPtr != null)
                        {
                            objectPtr.Dispose();
                        }
                        objectPtr = null;
                        ptr = IntPtr.Zero;
                    }
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }
 /// <summary>
 /// the full constructor that takes the length of the history, the number of gaussian mixtures, the background ratio parameter and the noise strength
 /// </summary>
 /// <param name="history"></param>
 /// <param name="varThreshold"></param>
 /// <param name="bShadowDetection"></param>
 public BackgroundSubtractorMOG2(int history, float varThreshold, bool bShadowDetection = true)
 {
     IntPtr po = NativeMethods.video_BackgroundSubtractorMOG2_new2(history, varThreshold, bShadowDetection ? 1 : 0);
     if (po == IntPtr.Zero)
         throw new OpenCvSharpException("Failed to create BackgroundSubtractorMOG2");
     objectPtr = new Ptr<BackgroundSubtractorMOG2>(po);
     ptr = objectPtr.Obj;
 }
 /// <summary>
 /// the default constructor
 /// </summary>
 public BackgroundSubtractorMOG()
 {
     IntPtr po = NativeMethods.video_BackgroundSubtractorMOG_new1();
     if (po == IntPtr.Zero)
         throw new OpenCvSharpException("Failed to create BackgroundSubtractorMOG");
     objectPtr = new Ptr<BackgroundSubtractorMOG>(po);
     ptr = objectPtr.Obj;
 }
 /// <summary>
 /// the full constructor that takes the length of the history, the number of gaussian mixtures, the background ratio parameter and the noise strength
 /// </summary>
 /// <param name="history"></param>
 /// <param name="nmixtures"></param>
 /// <param name="backgroundRatio"></param>
 /// <param name="noiseSigma"></param>
 public BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma=0)
 {
     IntPtr po = NativeMethods.video_BackgroundSubtractorMOG_new2(history, nmixtures, backgroundRatio, noiseSigma);
     if (po == IntPtr.Zero)
         throw new OpenCvSharpException("Failed to create BackgroundSubtractorMOG");
     objectPtr = new Ptr<BackgroundSubtractorMOG>(po);
     ptr = objectPtr.Obj;
 }
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static new BackgroundSubtractorMOG FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid BackgroundSubtractorMOG pointer");

            var ptrObj = new Ptr<BackgroundSubtractorMOG>(ptr);
            var obj = new BackgroundSubtractorMOG(ptrObj, ptrObj.Obj);
            return obj;
        }
Esempio n. 13
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal new static BriefDescriptorExtractor FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid BriefDescriptorExtractor pointer");

            var ptrObj = new Ptr<BriefDescriptorExtractor>(ptr);
            var extractor = new BriefDescriptorExtractor(ptrObj,ptrObj.Obj);
            return extractor;
        }
Esempio n. 14
0
        /// <summary>
        /// SURF初期化
        /// </summary>
        /// <param name="hessianThreshold">keypoint.hessian の値がこの閾値よりも大きい特徴だけが検出される</param>
        /// <param name="nOctaves"></param>
        /// <param name="nOctaveLayers"></param>
        /// <param name="extended">false:基本的なディスクリプタ(64要素), true:拡張されたディスクリプタ(128要素)</param>
        /// <param name="upright"></param>
#else
        /// <summary>
        /// The SURF constructor.
        /// </summary>
        /// <param name="hessianThreshold">Only features with keypoint.hessian larger than that are extracted. </param>
        /// <param name="nOctaves">The number of a gaussian pyramid octaves that the detector uses. It is set to 4 by default. 
        /// If you want to get very large features, use the larger value. If you want just small features, decrease it.</param>
        /// <param name="nOctaveLayers">The number of images within each octave of a gaussian pyramid. It is set to 2 by default.</param>
        /// <param name="extended">false means basic descriptors (64 elements each), true means extended descriptors (128 elements each) </param>
        /// <param name="upright">false means that detector computes orientation of each feature.
        /// true means that the orientation is not computed (which is much, much faster).</param>
#endif
        public SURF(double hessianThreshold,
            int nOctaves = 4, int nOctaveLayers = 2,
            bool extended = true, bool upright = false)
            : base()
        {
            ptr = NativeMethods.nonfree_SURF_new(hessianThreshold, nOctaves, nOctaveLayers,
                extended ? 1 : 0, upright ? 1 : 0);
            detectorPtr = null;
        }
Esempio n. 15
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static FrameSource FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid FrameSource pointer");
     var obj = new FrameSourceImpl();
     var ptrObj = new Ptr<FrameSource>(ptr);
     obj.ptrObj = ptrObj;
     obj.ptr = ptr;
     return obj;
 }
Esempio n. 16
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static FaceRecognizer FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<FaceRecognizer> pointer");
     var ptrObj = new Ptr<FaceRecognizer>(ptr);
     var detector = new FaceRecognizer
         {
             recognizerPtr = ptrObj, 
             ptr = ptrObj.Obj
         };
     return detector;
 }
Esempio n. 17
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static Feature2D FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<Feature2D> pointer");
     var ptrObj = new Ptr<Feature2D>(ptr);
     var detector = new Feature2D
     {
         ptrObj = ptrObj,
         ptr = ptrObj.Get()
     };
     return detector;
 }
Esempio n. 18
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static DescriptorMatcher FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid cv::Ptr<DescriptorMatcher> pointer");
     var ptrObj = new Ptr<DescriptorMatcher>(ptr);
     var detector = new DescriptorMatcher
         {
             detectorPtr = ptrObj, 
             ptr = ptrObj.Obj
         };
     return detector;
 }
Esempio n. 19
0
 /// <summary>
 /// Creates instance from cv::Ptr&lt;T&gt; .
 /// ptr is disposed when the wrapper disposes. 
 /// </summary>
 /// <param name="ptr"></param>
 internal static SuperResolutionImpl FromPtr(IntPtr ptr)
 {
     if (ptr == IntPtr.Zero)
         throw new OpenCvSharpException("Invalid FrameSource pointer");
     
     var ptrObj = new Ptr<SuperResolution>(ptr);
     var obj = new SuperResolutionImpl
         {
             detectorPtr = ptrObj, 
             ptr = ptrObj.Obj
         };
     return obj;
 }
Esempio n. 20
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static DescriptorExtractor FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid DescriptorExtractor pointer");

            var ptrObj = new Ptr<DescriptorExtractor>(ptr);
            var extractor = new DescriptorExtractor
                {
                    extractorPtr = ptrObj,
                    ptr = ptrObj.Obj
                };
            return extractor;
        }
Esempio n. 21
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static DenseOpticalFlowImpl FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid DenseOpticalFlow pointer");

            var ptrObj = new Ptr<DenseOpticalFlow>(ptr);
            var obj = new DenseOpticalFlowImpl
            {
                detectorPtr = ptrObj,
                ptr = ptrObj.Get()
            };
            return obj;
        }
Esempio n. 22
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static BackgroundSubtractor FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid BackgroundSubtractor pointer");

            var ptrObj = new Ptr<BackgroundSubtractor>(ptr);
            var obj = new BackgroundSubtractor
            {
                objectPtr = ptrObj,
                ptr = ptrObj.Obj
            };
            return obj;
        }
Esempio n. 23
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static CLAHE FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid CLAHE pointer");

            var ptrObj = new Ptr<CLAHE>(ptr);
            var ret = new CLAHE
                {
                    ptr = ptrObj.Obj,
                    ptrObj = ptrObj,
                };
            return ret;
        }
Esempio n. 24
0
        /// <summary>
        /// Creates instance from cv::Ptr&lt;T&gt; .
        /// ptr is disposed when the wrapper disposes. 
        /// </summary>
        /// <param name="ptr"></param>
        internal static FeatureDetector FromPtr(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Invalid FeatureDetector pointer");

            var ptrObj = new Ptr<FeatureDetector>(ptr);
            var detector = new FeatureDetector
                {
                    detectorPtr = ptrObj,
                    ptr = ptrObj.Obj
                };
            return detector;
        }
Esempio n. 25
0
        static RpcRuntime()
        {
            Is64BitProcess = (IntPtr.Size == 8);
            RpcTrace.Verbose("Is64BitProcess = {0}", Is64BitProcess);

            if (Is64BitProcess)
            {
                //Same as 32-bit except: [8] = 8; [32] = 24;
                TYPE_FORMAT = new byte[39]
                    {
                        0x00, 0x00, 0x1b, 0x00, 0x01, 0x00, 0x28, 0x00, 0x08, 0x00,
                        0x01, 0x00, 0x01, 0x5b, 0x11, 0x0c, 0x08, 0x5c, 0x11, 0x14,
                        0x02, 0x00, 0x12, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x01, 0x00,
                        0x28, 0x54, 0x18, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x00
                    };
                //Very different from 32-bit:
                FUNC_FORMAT = new byte[61]
                    {
                        0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00,
                        0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x24, 0x00, 0x47, 0x05,
                        0x0a, 0x07, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x48, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x10, 0x00,
                        0x02, 0x00, 0x50, 0x21, 0x18, 0x00, 0x08, 0x00, 0x13, 0x20,
                        0x20, 0x00, 0x12, 0x00, 0x70, 0x00, 0x28, 0x00, 0x10, 0x00,
                        0x00
                    };
            }
            else
            {
                TYPE_FORMAT = new byte[39]
                                  {
                        0x00, 0x00, 0x1b, 0x00, 0x01, 0x00, 0x28, 0x00, 0x04, 0x00,
                        0x01, 0x00, 0x01, 0x5b, 0x11, 0x0c, 0x08, 0x5c, 0x11, 0x14,
                        0x02, 0x00, 0x12, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x01, 0x00,
                        0x28, 0x54, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x00
                                  };
                FUNC_FORMAT = new byte[59]
                                  {
                        0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
                        0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x24, 0x00, 0x47, 0x05,
                        0x08, 0x07, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00,
                        0x04, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x02, 0x00,
                        0x50, 0x21, 0x0c, 0x00, 0x08, 0x00, 0x13, 0x20, 0x10, 0x00,
                        0x12, 0x00, 0x70, 0x00, 0x14, 0x00, 0x10, 0x00, 0x00
                                  };
            }
            FUNC_FORMAT_PTR = new Ptr<byte[]>(FUNC_FORMAT);
        }
        static RpcApi()
        {
            Is64BitProcess = (IntPtr.Size == 8);
            Log.Verbose("Is64BitProcess = {0}", Is64BitProcess);

            if (Is64BitProcess)
            {
                TYPE_FORMAT = new byte[]
                    {
                        0x00, 0x00, 0x1b, 0x00, 0x01, 0x00, 0x28, 0x00, 0x08, 0x00,
                        0x01, 0x00, 0x01, 0x5b, 0x11, 0x0c, 0x08, 0x5c, 0x11, 0x14,
                        0x02, 0x00, 0x12, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x01, 0x00,
                        0x28, 0x54, 0x18, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x00
                    };
                FUNC_FORMAT = new byte[]
                    {
                        0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00,
                        0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x24, 0x00, 0x47, 0x05,
                        0x0a, 0x07, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
                        0x48, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x10, 0x00,
                        0x02, 0x00, 0x50, 0x21, 0x18, 0x00, 0x08, 0x00, 0x13, 0x20,
                        0x20, 0x00, 0x12, 0x00, 0x70, 0x00, 0x28, 0x00, 0x10, 0x00,
                        0x00
                    };
            }
            else
            {
                TYPE_FORMAT = new byte[]
                    {
                        0x00, 0x00, 0x1b, 0x00, 0x01, 0x00, 0x28, 0x00, 0x04, 0x00,
                        0x01, 0x00, 0x01, 0x5b, 0x11, 0x0c, 0x08, 0x5c, 0x11, 0x14,
                        0x02, 0x00, 0x12, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x01, 0x00,
                        0x28, 0x54, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x00
                    };
                FUNC_FORMAT = new byte[]
                    {
                        0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
                        0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x24, 0x00, 0x47, 0x05,
                        0x08, 0x07, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00,
                        0x04, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x02, 0x00,
                        0x50, 0x21, 0x0c, 0x00, 0x08, 0x00, 0x13, 0x20, 0x10, 0x00,
                        0x12, 0x00, 0x70, 0x00, 0x14, 0x00, 0x10, 0x00, 0x00
                    };
            }
            FUNC_FORMAT_PTR = new Ptr<byte[]>(FUNC_FORMAT);
        }
Esempio n. 27
0
        public void Add(Ptr freeChunk)
        {
            if (free.Count == 0)
                free.Add(freeChunk);
            else
            {
                var last = free[free.Count - 1];
                if (freeChunk.Position > last.PositionPlusSize)
                    free.Add(freeChunk);
                else if (freeChunk.Position == last.PositionPlusSize)
                {
                    last.Size += freeChunk.Size;
                    free[free.Count - 1] = last;
                }
                else
                    throw new ArgumentException("Invalid ptr order.");
            }

            FreeBytes += freeChunk.Size;
        }
        public RPC_SERVER_INTERFACE(RpcHandle handle, Ptr<MIDL_SERVER_INFO> pServer, Guid iid)
        {
            Length = (uint) Marshal.SizeOf(typeof (RPC_CLIENT_INTERFACE));
            InterfaceId = new RPC_SYNTAX_IDENTIFIER() {SyntaxGUID = iid, SyntaxVersion = RPC_VERSION.INTERFACE_VERSION};
            TransferSyntax = new RPC_SYNTAX_IDENTIFIER()
                                 {SyntaxGUID = IID_SYNTAX, SyntaxVersion = RPC_VERSION.SYNTAX_VERSION};

            RPC_DISPATCH_TABLE fnTable = new RPC_DISPATCH_TABLE();
            fnTable.DispatchTableCount = 1;
            fnTable.DispatchTable =
                handle.Pin(new RPC_DISPATCH_TABLE_Entry()
                               {DispatchMethod = RpcApi.ServerEntry.Handle, Zero = IntPtr.Zero});
            fnTable.Reserved = IntPtr.Zero;

            DispatchTable = handle.Pin(fnTable);
            RpcProtseqEndpointCount = 0u;
            RpcProtseqEndpoint = IntPtr.Zero;
            DefaultManagerEpv = IntPtr.Zero;
            InterpreterInfo = pServer.Handle;
            Flags = 0x04000000u;
        }
Esempio n. 29
0
        private static RPC_SERVER_INTERFACE CreateExplicitBytesServer(RpcHandle handle, Ptr<MIDL_SERVER_INFO> pServer, Guid iid)
        {
            var server = new RPC_SERVER_INTERFACE();
            server.Length = (uint)Marshal.SizeOf(typeof(RPC_SERVER_INTERFACE));
            server.InterfaceId = new RPC_SYNTAX_IDENTIFIER() { SyntaxGUID = iid, SyntaxVersion = ExplicitBytesConstants.INTERFACE_VERSION };
            server.TransferSyntax = new RPC_SYNTAX_IDENTIFIER() { SyntaxGUID = SYNTAX.SYNTAX_IID, SyntaxVersion = SYNTAX.SYNTAX_VERSION };

            var fnTable = new RPC_DISPATCH_TABLE();
            fnTable.DispatchTableCount = 1;
            fnTable.DispatchTable =
                handle.Pin(new RPC_DISPATCH_TABLE_Entry() { DispatchMethod = RpcRuntime.ServerEntry.Handle, Zero = IntPtr.Zero });
            fnTable.Reserved = IntPtr.Zero;

            server.DispatchTable = handle.Pin(fnTable);
            server.RpcProtseqEndpointCount = 0u;
            server.RpcProtseqEndpoint = IntPtr.Zero;
            server.DefaultManagerEpv = IntPtr.Zero;
            server.InterpreterInfo = pServer.Handle;
            server.Flags = 0x04000000u;
            return server;
        }
Esempio n. 30
0
        /// <summary>
        /// リソースの解放
        /// </summary>
        /// <param name="disposing">
        /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。
        /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。
        ///</param>
#else
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">
        /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed.
        /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
        /// </param>
#endif
        protected override void Dispose(bool disposing)
        {
            if (!disposed)
            {
                try
                {
                    if (disposing)
                    {
                        if (ptrObj != null)
                        {
                            ptrObj.Dispose();
                            ptrObj = null;
                        }
                    }
                    ptr = IntPtr.Zero;
                    disposed = true;
                }
                finally
                {
                    base.Dispose(disposing);
                }
            }
        }
Esempio n. 31
0
 /// <summary>
 /// Creates instance by raw pointer cv::ml::SVM*
 /// </summary>
 protected DTrees(IntPtr p)
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
Esempio n. 32
0
 /// <summary>
 /// Creates instance by raw pointer cv::SURF*
 /// </summary>
 protected SURF(IntPtr ptr)
     : base()
 {
     detectorPtr = new Ptr <SURF>(ptr);
     ptr         = detectorPtr.Get();
 }
 /// <summary>
 ///
 /// </summary>
 protected DetectorParameters(IntPtr p)
 {
     ObjectPtr = new Ptr(p);
     ptr       = ObjectPtr.Get();
 }
Esempio n. 34
0
        private static byte[] InvokeRpc(RpcHandle handle, Guid iid, byte[] input)
        {
            Log.Verbose("InvokeRpc on {0}, sending {1} bytes", handle.Handle, input.Length);
            Ptr <MIDL_STUB_DESC> pStub;

            if (!handle.GetPtr(out pStub))
            {
                pStub =
                    handle.CreatePtr(new MIDL_STUB_DESC(handle, handle.Pin(new RPC_CLIENT_INTERFACE(iid)),
                                                        RpcApi.TYPE_FORMAT,
                                                        false));
            }
            int    szResponse = 0;
            IntPtr response, result;

            using (Ptr <byte[]> pInputBuffer = new Ptr <byte[]>(input))
            {
                if (RpcApi.Is64BitProcess)
                {
                    try
                    {
                        result = NdrClientCall2x64(pStub.Handle, RpcApi.FUNC_FORMAT_PTR.Handle, handle.Handle,
                                                   input.Length,
                                                   pInputBuffer.Handle, out szResponse, out response);
                    }
                    catch (SEHException ex)
                    {
                        Log.Error(ex);
                        RpcException.Assert(ex.ErrorCode);
                        throw;
                    }
                }
                else
                {
                    using (Ptr <Int32[]> pStack32 = new Ptr <Int32[]>(new Int32[10]))
                    {
                        pStack32.Data[0] = handle.Handle.ToInt32();
                        pStack32.Data[1] = input.Length;
                        pStack32.Data[2] = pInputBuffer.Handle.ToInt32();
                        pStack32.Data[3] = pStack32.Handle.ToInt32() + (sizeof(int) * 6);
                        pStack32.Data[4] = pStack32.Handle.ToInt32() + (sizeof(int) * 8);
                        pStack32.Data[5] = 0; //reserved
                        pStack32.Data[6] = 0; //output: int dwSizeResponse
                        pStack32.Data[8] = 0; //output: byte* lpResponse

                        try
                        {
                            result = NdrClientCall2x86(pStub.Handle, RpcApi.FUNC_FORMAT_PTR.Handle, pStack32.Handle);
                        }
                        catch (SEHException ex)
                        {
                            Log.Error(ex);
                            RpcException.Assert(ex.ErrorCode);
                            throw;
                        }

                        szResponse = pStack32.Data[6];
                        response   = new IntPtr(pStack32.Data[8]);
                    }
                }
                GC.KeepAlive(pInputBuffer);
            }
            RpcException.Assert(result.ToInt32());
            Log.Verbose("InvokeRpc.InvokeRpc response on {0}, recieved {1} bytes", handle.Handle, szResponse);
            byte[] output = new byte[szResponse];
            if (szResponse > 0 && response != IntPtr.Zero)
            {
                Marshal.Copy(response, output, 0, output.Length);
            }
            RpcApi.Free(response);

            return(output);
        }
Esempio n. 35
0
 /// <summary>
 /// Creates instance by raw pointer cv::ml::NormalBayesClassifier*
 /// </summary>
 protected NormalBayesClassifier(IntPtr p)
 {
     ptrObj = new Ptr <NormalBayesClassifier>(p);
     ptr    = ptrObj.Get();
 }
Esempio n. 36
0
 /// <inheritdoc />
 /// <summary>
 /// Releases managed resources
 /// </summary>
 protected override void DisposeManaged()
 {
     recognizerPtr?.Dispose();
     recognizerPtr = null;
     base.DisposeManaged();
 }
Esempio n. 37
0
 /// <summary>
 /// Creates instance by raw pointer
 /// </summary>
 protected SelectiveSearchSegmentationStrategy(Ptr ptrObj)
 {
     PtrObj = ptrObj ?? throw new ArgumentNullException(nameof(ptrObj));
     ptr    = ptrObj.Get();
 }
Esempio n. 38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ptrObj"></param>
 protected Tracker(Ptr ptrObj)
 {
     PtrObj = ptrObj;
     ptr    = ptrObj.Get();
 }
Esempio n. 39
0
 static extern int SetForegroundWindow(Ptr hWnd);
 /// <summary>
 /// Releases managed resources
 /// </summary>
 protected override void DisposeManaged()
 {
     PtrObj?.Dispose();
     PtrObj = null;
     base.DisposeManaged();
 }
 /// <summary>
 ///
 /// </summary>
 internal Dictionary(IntPtr p)
 {
     ObjectPtr = new Ptr(p);
     ptr       = ObjectPtr.Get();
 }
Esempio n. 42
0
 /// <summary>
 /// Creates instance by raw pointer cv::ml::ANN_MLP*
 /// </summary>
 protected ANN_MLP(IntPtr p)
     : base()
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
 /// <summary>
 /// Creates instance by raw pointer cv::ml::LogisticRegression*
 /// </summary>
 protected LogisticRegression(IntPtr p)
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
Esempio n. 44
0
 /// <summary>
 ///
 /// </summary>
 protected DTrees()
 {
     ptrObj = null;
 }
Esempio n. 45
0
 public override void Commit(Ptr ptr)
 {
     _Adapter.Commit(ptr);
 }
Esempio n. 46
0
 public override void Abort(Ptr ptr)
 {
     _Adapter.Abort(ptr);
 }
Esempio n. 47
0
 public ColliderTouch(Ptr pointer)
 {
     flags = pointer.ReadInt32(0);
     effect = pointer.ReadByte(4);
     damage = pointer.ReadByte(5);
 }
Esempio n. 48
0
 /// <summary>
 ///
 /// </summary>
 protected TrackerMIL(IntPtr p)
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
 /// <summary>
 /// Creates instance by raw pointer
 /// </summary>
 protected QualityBRISQUE(IntPtr p)
     : base()
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
Esempio n. 50
0
 /// <summary>
 ///
 /// </summary>
 protected FaceRecognizer()
 {
     recognizerPtr = null;
     ptr           = IntPtr.Zero;
 }
Esempio n. 51
0
 /// <summary>
 ///
 /// </summary>
 protected TrackerGOTURN(IntPtr p)
 {
     ptrObj = new Ptr(p);
     ptr    = ptrObj.Get();
 }
 /// <summary>
 /// Creates instance by raw pointer
 /// </summary>
 protected RFFeatureGetter(IntPtr p)
 {
     PtrObj = new Ptr(p);
     ptr    = PtrObj.Get();
 }