本文整理汇总了C#中Mat.ThrowIfDisposed方法的典型用法代码示例。如果您正苦于以下问题:C# Mat.ThrowIfDisposed方法的具体用法?C# Mat.ThrowIfDisposed怎么用?C# Mat.ThrowIfDisposed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat
的用法示例。
在下文中一共展示了Mat.ThrowIfDisposed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnqueueDownload
/// <summary>
/// Downloads asynchronously.
/// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat)
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
public void EnqueueDownload(GpuMat src, Mat dst)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException(nameof(src));
if (dst == null)
throw new ArgumentNullException(nameof(dst));
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueDownload_Mat(ptr, src.CvPtr, dst.CvPtr);
}
示例2: EnqueueUpload
/// <summary>
/// Uploads asynchronously.
/// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI)
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
public void EnqueueUpload(Mat src, GpuMat dst)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueUpload_Mat(ptr, src.CvPtr, dst.CvPtr);
}
示例3: SepFilter2D
/// <summary>
/// Applies a separable 2D linear filter to an image.
/// </summary>
/// <param name="src">Source image.
/// CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_32SC1, CV_32FC1 source types are supported.</param>
/// <param name="dst">Destination image with the same size and number of channels as src.</param>
/// <param name="ddepth">Destination image depth. CV_8U, CV_16S, CV_32S, and CV_32F are supported.</param>
/// <param name="kernelX">Horizontal filter coefficients.</param>
/// <param name="kernelY">Vertical filter coefficients.</param>
/// <param name="buf"></param>
/// <param name="anchor">Anchor position within the kernel.
/// The default value (-1, 1) means that the anchor is at the kernel center.</param>
/// <param name="rowBorderType">Pixel extrapolation method in the vertical direction.</param>
/// <param name="columnBorderType">Pixel extrapolation method in the horizontal direction.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void SepFilter2D(
GpuMat src, GpuMat dst, int ddepth, Mat kernelX, Mat kernelY, GpuMat buf,
Point? anchor = null, BorderType rowBorderType = BorderType.Default,
BorderType columnBorderType = BorderType.Auto, Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
if (kernelX == null)
throw new ArgumentNullException("kernelX");
if (kernelY == null)
throw new ArgumentNullException("kernelY");
if (buf == null)
throw new ArgumentNullException("buf");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
kernelX.ThrowIfDisposed();
kernelY.ThrowIfDisposed();
buf.ThrowIfDisposed();
Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1));
NativeMethods.gpu_sepFilter2D2(
src.CvPtr, dst.CvPtr, ddepth, kernelX.CvPtr, kernelY.CvPtr, buf.CvPtr,
anchor0, (int)rowBorderType, (int)columnBorderType, Cv2.ToPtr(stream));
}
示例4: Filter2D
/// <summary>
/// Applies the non-separable 2D linear filter to an image.
/// </summary>
/// <param name="src">Source image. Supports CV_8U, CV_16U and CV_32F one and four channel image.</param>
/// <param name="dst">Destination image. The size and the number of channels is the same as src.</param>
/// <param name="ddepth">Desired depth of the destination image. If it is negative, it is the same as src.depth().
/// It supports only the same depth as the source image depth.</param>
/// <param name="kernel">2D array of filter coefficients.</param>
/// <param name="anchor">Anchor of the kernel that indicates the relative position of
/// a filtered point within the kernel. The anchor resides within the kernel.
/// The special default value (-1,-1) means that the anchor is at the kernel center.</param>
/// <param name="borderType">Pixel extrapolation method.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void Filter2D(
GpuMat src, GpuMat dst, int ddepth, Mat kernel, Point? anchor,
BorderType borderType = BorderType.Default, Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
if (kernel == null)
throw new ArgumentNullException("kernel");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
kernel.ThrowIfDisposed();
Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1));
NativeMethods.gpu_filter2D(src.CvPtr, dst.CvPtr, ddepth, kernel.CvPtr,
anchor0, (int)borderType, Cv2.ToPtr(stream));
}
示例5: MorphologyEx
/// <summary>
/// Applies an advanced morphological operation to an image.
/// </summary>
/// <param name="src">Source image. CV_8UC1 and CV_8UC4 source types are supported.</param>
/// <param name="dst">Destination image with the same size and type as src.</param>
/// <param name="op">Type of morphological operation</param>
/// <param name="kernel">Structuring element.</param>
/// <param name="buf1"></param>
/// <param name="buf2"></param>
/// <param name="anchor">Position of an anchor within the element.
/// The default value Point(-1, -1) means that the anchor is at the element center.</param>
/// <param name="iterations">Number of times erosion and dilation to be applied.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void MorphologyEx(
GpuMat src, GpuMat dst, MorphologyOperation op, Mat kernel, GpuMat buf1, GpuMat buf2,
Point? anchor = null, int iterations = 1, Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
if (kernel == null)
throw new ArgumentNullException("kernel");
if (buf1 == null)
throw new ArgumentNullException("buf1");
if (buf2 == null)
throw new ArgumentNullException("buf2");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
kernel.ThrowIfDisposed();
buf1.ThrowIfDisposed();
buf2.ThrowIfDisposed();
Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1));
NativeMethods.gpu_morphologyEx2(src.CvPtr, dst.CvPtr, (int)op, kernel.CvPtr,
buf1.CvPtr, buf2.CvPtr, anchor0, iterations, Cv2.ToPtr(stream));
}
示例6: Dilate
/// <summary>
/// Dilates an image by using a specific structuring element.
/// </summary>
/// <param name="src">Source image. Only CV_8UC1 and CV_8UC4 types are supported.</param>
/// <param name="dst">Destination image with the same size and type as src.</param>
/// <param name="kernel">Structuring element used for erosion. If kernel=Mat(),
/// a 3x3 rectangular structuring element is used.</param>
/// <param name="buf"></param>
/// <param name="anchor">Position of an anchor within the element.
/// The default value (-1, -1) means that the anchor is at the element center.</param>
/// <param name="iterations">Number of times erosion to be applied.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void Dilate(
GpuMat src, GpuMat dst, Mat kernel, GpuMat buf,
Point? anchor, int iterations = 1, Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
if (kernel == null)
throw new ArgumentNullException("kernel");
if (buf == null)
throw new ArgumentNullException("buf");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
kernel.ThrowIfDisposed();
buf.ThrowIfDisposed();
Point anchor0 = anchor.GetValueOrDefault(new Point(-1, -1));
NativeMethods.gpu_dilate2(src.CvPtr, dst.CvPtr, kernel.CvPtr,
buf.CvPtr, anchor0, iterations, Cv2.ToPtr(stream));
}