本文整理汇总了C#中GpuMat.ThrowIfDisposed方法的典型用法代码示例。如果您正苦于以下问题:C# GpuMat.ThrowIfDisposed方法的具体用法?C# GpuMat.ThrowIfDisposed怎么用?C# GpuMat.ThrowIfDisposed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuMat
的用法示例。
在下文中一共展示了GpuMat.ThrowIfDisposed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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(CudaMem src, GpuMat dst)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.gpu_Stream_enqueueUpload_CudaMem(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(nameof(src));
if (dst == null)
throw new ArgumentNullException(nameof(dst));
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueUpload_Mat(ptr, src.CvPtr, dst.CvPtr);
}
示例3: MinMaxLoc
/// <summary>
/// Finds global minimum and maximum array elements and returns their values with locations
/// </summary>
/// <param name="src">Single-channel source image.</param>
/// <param name="minVal">Pointer to the returned minimum value.</param>
/// <param name="maxVal">Pointer to the returned maximum value.</param>
/// <param name="minLoc">Pointer to the returned minimum location.</param>
/// <param name="maxLoc">Pointer to the returned maximum location.</param>
/// <param name="mask">Optional mask to select a sub-matrix.</param>
/// <param name="valbuf">Optional values buffer to avoid extra memory allocations.
/// It is resized automatically.</param>
/// <param name="locbuf">Optional locations buffer to avoid extra memory allocations.
/// It is resized automatically.</param>
public static void MinMaxLoc(
GpuMat src, out double minVal, out double maxVal, out Point minLoc, out Point maxLoc,
GpuMat mask, GpuMat valbuf, GpuMat locbuf)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (valbuf == null)
throw new ArgumentNullException("valbuf");
if (locbuf == null)
throw new ArgumentNullException("locbuf");
src.ThrowIfDisposed();
valbuf.ThrowIfDisposed();
locbuf.ThrowIfDisposed();
NativeMethods.gpu_minMaxLoc2(
src.CvPtr, out minVal, out maxVal, out minLoc, out maxLoc, Cv2.ToPtr(mask),
valbuf.CvPtr, locbuf.CvPtr);
}
示例4: MatchTemplate
/// <summary>
/// Computes a proximity map for a raster template and an image where the template is searched for.
/// </summary>
/// <param name="image">Source image. CV_32F and CV_8U depth images (1..4 channels) are supported for now.</param>
/// <param name="templ">Template image with the size and type the same as image.</param>
/// <param name="result">Map containing comparison results (CV_32FC1). If image is W x H and templ is w x h, then result must be W-w+1 x H-h+1.</param>
/// <param name="method">Specifies the way to compare the template with the image.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void MatchTemplate(
GpuMat image, GpuMat templ, GpuMat result, MatchTemplateMethod method,
Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (image == null)
throw new ArgumentNullException("image");
if (templ == null)
throw new ArgumentNullException("templ");
if (result == null)
throw new ArgumentNullException("result");
image.ThrowIfDisposed();
templ.ThrowIfDisposed();
result.ThrowIfDisposed();
NativeMethods.gpu_matchTemplate1(
image.CvPtr, templ.CvPtr, result.CvPtr, (int)method, Cv2.ToPtr(stream));
}
示例5: 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="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>
public static void Dilate(
GpuMat src, GpuMat dst, Mat kernel, Point? anchor = null, int iterations = 1)
{
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_dilate1(src.CvPtr, dst.CvPtr, kernel.CvPtr, anchor0, iterations);
}
示例6: Scharr
/// <summary>
/// Calculates the first x- or y- image derivative using the Scharr operator.
/// </summary>
/// <param name="src">Source image.
/// CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_16SC3, CV_32SC1, CV_32FC1 source types are supported.</param>
/// <param name="dst">Destination image with the same size and number of channels as source image.</param>
/// <param name="ddepth">Destination image depth. CV_8U, CV_16S, CV_32S, and CV_32F are supported.</param>
/// <param name="dx">Derivative order in respect of x.</param>
/// <param name="dy">Derivative order in respect of y.</param>
/// <param name="buf"></param>
/// <param name="scale">Optional scale factor for the computed derivative values. By default, no scaling is applied.</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 Scharr(
GpuMat src, GpuMat dst, int ddepth, int dx, int dy, GpuMat buf, double scale = 1,
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 (buf == null)
throw new ArgumentNullException("buf");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
buf.ThrowIfDisposed();
NativeMethods.gpu_Scharr2(
src.CvPtr, dst.CvPtr, ddepth, dx, dy, buf.CvPtr, scale,
(int)rowBorderType, (int)columnBorderType, Cv2.ToPtr(stream));
}
示例7: EnqueueMemSet
/// <summary>
/// Memory set asynchronously
/// </summary>
/// <param name="src"></param>
/// <param name="val"></param>
/// <param name="mask"></param>
public void EnqueueMemSet(GpuMat src, Scalar val, GpuMat mask)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException("src");
src.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueMemSet_WithMask(ptr, src.CvPtr, val, Cv2.ToPtr(mask));
}
示例8: 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));
}
示例9: 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));
}
示例10: 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));
}
示例11: EnqueueMemSet
/// <summary>
/// Memory set asynchronously
/// </summary>
/// <param name="src"></param>
/// <param name="val"></param>
public void EnqueueMemSet(GpuMat src, Scalar val)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException(nameof(src));
src.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueMemSet(ptr, src.CvPtr, val);
}
示例12: GaussianBlur
/// <summary>
/// Smooths an image using the Gaussian filter.
/// </summary>
/// <param name="src">Source image.
/// CV_8UC1, CV_8UC4, CV_16SC1, CV_16SC2, CV_16SC3, CV_32SC1, CV_32FC1 source types are supported.</param>
/// <param name="dst">Destination image with the same size and type as src.</param>
/// <param name="ksize">Gaussian kernel size. ksize.Width and ksize.Height can differ
/// but they both must be positive and odd. If they are zeros,
/// they are computed from sigma1 and sigma2 .</param>
/// <param name="buf"></param>
/// <param name="sigma1">Gaussian kernel standard deviation in X direction.</param>
/// <param name="sigma2">Gaussian kernel standard deviation in Y direction.
/// If sigma2 is zero, it is set to be equal to sigma1 . If they are both zeros,
/// they are computed from ksize.Width and ksize.Height, respectively.
/// To fully control the result regardless of possible future modification of all
/// this semantics, you are recommended to specify all of ksize, sigma1, and sigma2.</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 GaussianBlur(
GpuMat src, GpuMat dst, Size ksize, GpuMat buf, double sigma1, double sigma2 = 0,
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 (buf == null)
throw new ArgumentNullException("buf");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
buf.ThrowIfDisposed();
NativeMethods.gpu_GaussianBlur2(
src.CvPtr, dst.CvPtr, ksize, buf.CvPtr, sigma1, sigma2,
(int)rowBorderType, (int)columnBorderType, Cv2.ToPtr(stream));
}
示例13: EnqueueCopy
/// <summary>
/// Copy asynchronously
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
public void EnqueueCopy(GpuMat 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_enqueueCopy(ptr, src.CvPtr, dst.CvPtr);
}
示例14: Laplacian
/// <summary>
/// Applies the Laplacian operator to an image.
/// </summary>
/// <param name="src">Source image. CV_8UC1 and CV_8UC4 source types are supported.</param>
/// <param name="dst">Destination image. The size and number of channels is the same as src.</param>
/// <param name="ddepth">Desired depth of the destination image. It supports only the same depth as the source image depth.</param>
/// <param name="ksize">Aperture size used to compute the second-derivative filters.
/// It must be positive and odd. Only ksize = 1 and ksize = 3 are supported.</param>
/// <param name="scale">Optional scale factor for the computed Laplacian values.</param>
/// <param name="borderType">Pixel extrapolation method.</param>
/// <param name="stream">Stream for the asynchronous version.</param>
public static void Laplacian(
GpuMat src, GpuMat dst, int ddepth, int ksize = 1, double scale = 1,
BorderType borderType = BorderType.Default, Stream stream = null)
{
ThrowIfGpuNotAvailable();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.gpu_Laplacian(
src.CvPtr, dst.CvPtr, ddepth, ksize, scale, (int)borderType, Cv2.ToPtr(stream));
}
示例15: EnqueueConvert
/// <summary>
/// converts matrix type, ex from float to uchar depending on type
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
/// <param name="dtype"></param>
/// <param name="a"></param>
/// <param name="b"></param>
public void EnqueueConvert(GpuMat src, GpuMat dst, int dtype, double a = 1, double b = 0)
{
ThrowIfDisposed();
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfDisposed();
NativeMethods.cuda_Stream_enqueueConvert(ptr, src.CvPtr, dst.CvPtr, dtype, a, b);
}