Exemplo n.º 1
0
 /// <summary>
 /// the default constructor
 /// </summary>
 /// <param name="nMixtures"></param>
 public MOG_GPU(int nMixtures = -1)
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_MOG_GPU_new(nMixtures);
     if (ptr == IntPtr.Zero)
     {
         throw new OpenCvSharpException();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// StereoBM_GPU コンストラクタ
        /// </summary>
        /// <param name="preset"></param>
        /// <param name="ndisparities"></param>
        /// <param name="winSize"></param>
#else
        /// <summary>
        /// StereoBM_GPU Constructor
        /// </summary>
        /// <param name="preset"></param>
        /// <param name="ndisparities"></param>
        /// <param name="winSize"></param>
#endif
        public StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
        {
            Cv2Gpu.ThrowIfGpuNotAvailable();
            ptr = NativeMethods.gpu_StereoBM_GPU_new2(preset, ndisparities, winSize);
            if (ptr == IntPtr.Zero)
            {
                throw new OpenCvSharpException();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="threshold">Threshold on difference between intensity of the central pixel and pixels on a circle around this pixel.</param>
 /// <param name="nonmaxSuppression">If it is true, non-maximum suppression is applied to detected corners (keypoints).</param>
 /// <param name="keypointsRatio">Inner buffer size for keypoints store is determined as (keypointsRatio * image_width * image_height).</param>
 public FAST_GPU(int threshold, bool nonmaxSuppression = true, double keypointsRatio = 0.05)
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_FAST_GPU_new(threshold, nonmaxSuppression ? 1 : 0, keypointsRatio);
     if (ptr == IntPtr.Zero)
     {
         throw new OpenCvSharpException();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// CascadeClassifier_GPU Constructor
 /// </summary>
 /// <param name="fileName"></param>
 public CascadeClassifier_GPU(string fileName)
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_CascadeClassifier_GPU_new2(fileName);
     if (ptr == IntPtr.Zero)
     {
         throw new OpenCvSharpException();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// デフォルトのパラメータで初期化.
        /// </summary>
#else
        /// <summary>
        /// Default constructor
        /// </summary>
#endif
        public StereoBM_GPU()
        {
            Cv2Gpu.ThrowIfGpuNotAvailable();
            ptr = NativeMethods.gpu_StereoBM_GPU_new1();
            if (ptr == IntPtr.Zero)
            {
                throw new OpenCvSharpException();
            }
        }
Exemplo n.º 6
0
 private void ThrowIfNotAvailable()
 {
     if (disposed)
     {
         throw new ObjectDisposedException(GetType().Name);
     }
     if (Cv2Gpu.GetCudaEnabledDeviceCount() < 1)
     {
         throw new OpenCvSharpException("GPU module cannot be used.");
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="nFeatures">The number of desired features.</param>
 /// <param name="scaleFactor">Coefficient by which we divide the dimensions from one scale pyramid level to the next.</param>
 /// <param name="nLevels">The number of levels in the scale pyramid.</param>
 /// <param name="edgeThreshold">How far from the boundary the points should be.</param>
 /// <param name="firstLevel">The level at which the image is given. If 1, that means we will also look at the image scaleFactor times bigger.</param>
 /// <param name="WTA_K"></param>
 /// <param name="scoreType"></param>
 /// <param name="patchSize"></param>
 public ORB_GPU(int nFeatures  = 500, float scaleFactor = 1.2f, int nLevels      = 8, int edgeThreshold = 31,
                int firstLevel = 0, int WTA_K           = 2, ScoreType scoreType = 0, int patchSize     = 31)
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_ORB_GPU_new(
         nFeatures, scaleFactor, nLevels, edgeThreshold,
         firstLevel, WTA_K, (int)scoreType, patchSize);
     if (ptr == IntPtr.Zero)
     {
         throw new OpenCvSharpException();
     }
 }
        /// <summary>
        /// Checks whether the opencv_gpu*.dll includes CUDA support.
        /// </summary>
        protected void ThrowIfNotAvailable()
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }
            if (Cv2Gpu.GetCudaEnabledDeviceCount() < 1)
            {
                throw new OpenCvSharpException("Your OpenCV DLL does not support GPU module.");
            }

            if (!IsGpuCompatible)
            {
                throw new OpenCvSharpException("The selected GPU device is not compatible.");
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// Creates DeviceInfo object for the given GPU
 /// </summary>
 /// <param name="deviceId"></param>
 public DeviceInfo(int deviceId)
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_DeviceInfo_new2(deviceId);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates DeviceInfo object for the current GPU
 /// </summary>
 public DeviceInfo()
 {
     Cv2Gpu.ThrowIfGpuNotAvailable();
     ptr = NativeMethods.gpu_DeviceInfo_new1();
 }