private void ThrowIfNotAvailable() { if (disposed) { throw new ObjectDisposedException(GetType().Name); } if (Cv2Gpu.GetCudaEnabledDeviceCount() < 1) { throw new OpenCvSharpException("GPU module cannot be used."); } }
/// <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."); } }
/// <summary> /// Creates DeviceInfo object for the given GPU /// </summary> /// <param name="deviceId"></param> public DeviceInfo(int deviceId) { Cv2Gpu.ThrowIfGpuNotAvailable(); ptr = NativeMethods.cuda_DeviceInfo_new2(deviceId); }