本文整理汇总了C#中OutputArray类的典型用法代码示例。如果您正苦于以下问题:C# OutputArray类的具体用法?C# OutputArray怎么用?C# OutputArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OutputArray类属于命名空间,在下文中一共展示了OutputArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBackgroundImage
/// <summary>
/// computes a background image
/// </summary>
/// <param name="backgroundImage"></param>
public virtual void GetBackgroundImage(OutputArray backgroundImage)
{
if (backgroundImage == null)
throw new ArgumentNullException("backgroundImage");
backgroundImage.ThrowIfNotReady();
NativeMethods.video_BackgroundSubtractor_getBackgroundImage(ptr, backgroundImage.CvPtr);
backgroundImage.Fix();
}
示例2: NextFrame
/// <summary>
/// Process next frame from input and return output result.
/// </summary>
/// <param name="frame">Output result</param>
public virtual void NextFrame(OutputArray frame)
{
if (firstCall)
{
InitImpl(frameSource);
firstCall = false;
}
ProcessImpl(frameSource, frame);
}
示例3: MedianBlur
/// <summary>
///
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
/// <param name="ksize"></param>
public static void MedianBlur(InputArray src, OutputArray dst, int ksize)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfNotReady();
NativeMethods.imgproc_medianBlur(src.CvPtr, dst.CvPtr, ksize);
dst.Fix();
}
示例4: ApplyColorMap
/// <summary>
///
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
/// <param name="colormap"></param>
public static void ApplyColorMap(InputArray src, OutputArray dst, ColorMapMode colormap)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfNotReady();
NativeMethods.contrib_applyColorMap(src.CvPtr, dst.CvPtr, (int)colormap);
dst.Fix();
}
示例5: CopyMakeBorder
/// <summary>
/// Forms a border around the image
/// </summary>
/// <param name="src">The source image</param>
/// <param name="dst">The destination image; will have the same type as src and
/// the size Size(src.cols+left+right, src.rows+top+bottom)</param>
/// <param name="top">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param>
/// <param name="bottom">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param>
/// <param name="left">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param>
/// <param name="right">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param>
/// <param name="borderType">The border type</param>
/// <param name="value">The border value if borderType == Constant</param>
public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, BorderType borderType, Scalar? value = null)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfNotReady();
Scalar value0 = value.GetValueOrDefault(new Scalar());
NativeMethods.imgproc_copyMakeBorder(src.CvPtr, dst.CvPtr, top, bottom, left, right, (int)borderType, value0);
dst.Fix();
}
示例6: FastNlMeansDenoising
/// <summary>
/// Perform image denoising using Non-local Means Denoising algorithm
/// with several computational optimizations. Noise expected to be a gaussian white noise
/// </summary>
/// <param name="src">Input 8-bit 1-channel, 2-channel or 3-channel image.</param>
/// <param name="dst">Output image with the same size and type as src .</param>
/// <param name="h">
/// Parameter regulating filter strength. Big h value perfectly removes noise but also removes image details,
/// smaller h value preserves details but also preserves some noise</param>
/// <param name="templateWindowSize">
/// Size in pixels of the template patch that is used to compute weights. Should be odd. Recommended value 7 pixels</param>
/// <param name="searchWindowSize">
/// Size in pixels of the window that is used to compute weighted average for given pixel.
/// Should be odd. Affect performance linearly: greater searchWindowsSize - greater denoising time. Recommended value 21 pixels</param>
public static void FastNlMeansDenoising(InputArray src, OutputArray dst, float h = 3,
int templateWindowSize = 7, int searchWindowSize = 21)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfNotReady();
NativeMethods.photo_fastNlMeansDenoising(src.CvPtr, dst.CvPtr, h, templateWindowSize, searchWindowSize);
dst.Fix();
}
示例7: Rodrigues
/// <summary>
/// converts rotation vector to rotation matrix or vice versa using Rodrigues transformation
/// </summary>
/// <param name="src">Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).</param>
/// <param name="dst">Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.</param>
/// <param name="jacobian">Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial derivatives of the output array components with respect to the input array components.</param>
public static void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian = null)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
dst.ThrowIfNotReady();
NativeMethods.calib3d_Rodrigues(src.CvPtr, dst.CvPtr, ToPtr(jacobian));
dst.Fix();
if (jacobian != null)
jacobian.Fix();
}
示例8: Apply
/// <summary>
/// the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image.
/// </summary>
/// <param name="image"></param>
/// <param name="fgmask"></param>
/// <param name="learningRate"></param>
public virtual void Apply(InputArray image, OutputArray fgmask, double learningRate = -1)
{
if (image == null)
throw new ArgumentNullException("image");
if (fgmask == null)
throw new ArgumentNullException("fgmask");
image.ThrowIfDisposed();
fgmask.ThrowIfNotReady();
NativeMethods.video_BackgroundSubtractor_apply(ptr, image.CvPtr, fgmask.CvPtr, learningRate);
fgmask.Fix();
GC.KeepAlive(image);
}
示例9: Inpaint
/// <summary>
/// restores the damaged image areas using one of the available intpainting algorithms
/// </summary>
/// <param name="src"></param>
/// <param name="inpaintMask"></param>
/// <param name="dst"></param>
/// <param name="inpaintRadius"></param>
/// <param name="flags"></param>
public static void Inpaint(InputArray src, InputArray inpaintMask,
OutputArray dst, double inpaintRadius, InpaintMethod flags)
{
if (src == null)
throw new ArgumentNullException("src");
if (inpaintMask == null)
throw new ArgumentNullException("inpaintMask");
if (dst == null)
throw new ArgumentNullException("dst");
src.ThrowIfDisposed();
inpaintMask.ThrowIfDisposed();
dst.ThrowIfNotReady();
NativeMethods.photo_inpaint(src.CvPtr, inpaintMask.CvPtr, dst.CvPtr, inpaintRadius, (int)flags);
dst.Fix();
}
示例10: GetDerivKernels
/// <summary>
/// Returns filter coefficients for computing spatial image derivatives.
/// </summary>
/// <param name="kx">Output matrix of row filter coefficients. It has the type ktype.</param>
/// <param name="ky">Output matrix of column filter coefficients. It has the type ktype.</param>
/// <param name="dx">Derivative order in respect of x.</param>
/// <param name="dy">Derivative order in respect of y.</param>
/// <param name="ksize">Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7.</param>
/// <param name="normalize">Flag indicating whether to normalize (scale down) the filter coefficients or not.
/// Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$.
/// If you are going to filter floating-point images, you are likely to use the normalized kernels.
/// But if you compute derivatives of an 8-bit image, store the results in a 16-bit image,
/// and wish to preserve all the fractional bits, you may want to set normalize = false.</param>
/// <param name="ktype">Type of filter coefficients. It can be CV_32f or CV_64F.</param>
public static void GetDerivKernels(
OutputArray kx, OutputArray ky, int dx, int dy, int ksize,
bool normalize = false, MatType? ktype = null)
{
if (kx == null)
throw new ArgumentNullException(nameof(kx));
if (ky == null)
throw new ArgumentNullException(nameof(ky));
kx.ThrowIfNotReady();
ky.ThrowIfNotReady();
var ktype0 = ktype.GetValueOrDefault(MatType.CV_32F);
NativeMethods.imgproc_getDerivKernels(
kx.CvPtr, ky.CvPtr, dx, dy, ksize, normalize ? 1 : 0, ktype0);
kx.Fix();
ky.Fix();
}
示例11: Process
/// <summary>
/// Recovers inverse camera response.
/// </summary>
/// <param name="src">vector of input images</param>
/// <param name="dst">256x1 matrix with inverse camera response function</param>
/// <param name="times">vector of exposure time values for each image</param>
public virtual void Process(IEnumerable<Mat> src, OutputArray dst, IEnumerable<float> times)
{
if (src == null)
throw new ArgumentNullException("src");
if (dst == null)
throw new ArgumentNullException("dst");
if (times == null)
throw new ArgumentNullException("times");
dst.ThrowIfNotReady();
IntPtr[] srcArray = EnumerableEx.SelectPtrs(src);
float[] timesArray = EnumerableEx.ToArray(times);
if (srcArray.Length != timesArray.Length)
throw new OpenCvSharpException("src.Count() != times.Count");
NativeMethods.photo_CalibrateCRF_process(ptr, srcArray, srcArray.Length, dst.CvPtr, timesArray);
dst.Fix();
GC.KeepAlive(src);
}
示例12: CalcMotionGradient
/// <summary>
/// Computes the motion gradient orientation image from the motion history image
/// </summary>
/// <param name="mhi">Motion history single-channel floating-point image.</param>
/// <param name="mask">Output mask image that has the type CV_8UC1 and the same size as mhi.
/// Its non-zero elements mark pixels where the motion gradient data is correct.</param>
/// <param name="orientation">Output motion gradient orientation image that has the same type and the same size as mhi.
/// Each pixel of the image is a motion orientation, from 0 to 360 degrees.</param>
/// <param name="delta1">Minimal (or maximal) allowed difference between mhi values within a pixel neighborhood.</param>
/// <param name="delta2">Maximal (or minimal) allowed difference between mhi values within a pixel neighborhood.
/// That is, the function finds the minimum ( m(x,y) ) and maximum ( M(x,y) ) mhi values over 3x3 neighborhood of each pixel
/// and marks the motion orientation at (x, y) as valid only if:
/// min(delta1, delta2) <= M(x,y)-m(x,y) <= max(delta1, delta2).</param>
/// <param name="apertureSize"></param>
public static void CalcMotionGradient(
InputArray mhi, OutputArray mask, OutputArray orientation,
double delta1, double delta2, int apertureSize = 3)
{
if (mhi == null)
throw new ArgumentNullException("mhi");
if (mask == null)
throw new ArgumentNullException("mask");
if (orientation == null)
throw new ArgumentNullException("orientation");
mhi.ThrowIfDisposed();
mask.ThrowIfNotReady();
orientation.ThrowIfNotReady();
NativeMethods.video_calcMotionGradient(
mhi.CvPtr, mask.CvPtr, orientation.CvPtr, delta1, delta2, apertureSize);
mask.Fix();
orientation.Fix();
}
示例13: BuildOpticalFlowPyramid
/// <summary>
/// Constructs a pyramid which can be used as input for calcOpticalFlowPyrLK
/// </summary>
/// <param name="img">8-bit input image.</param>
/// <param name="pyramid">output pyramid.</param>
/// <param name="winSize">window size of optical flow algorithm.
/// Must be not less than winSize argument of calcOpticalFlowPyrLK().
/// It is needed to calculate required padding for pyramid levels.</param>
/// <param name="maxLevel">0-based maximal pyramid level number.</param>
/// <param name="withDerivatives">set to precompute gradients for the every pyramid level.
/// If pyramid is constructed without the gradients then calcOpticalFlowPyrLK() will
/// calculate them internally.</param>
/// <param name="pyrBorder">the border mode for pyramid layers.</param>
/// <param name="derivBorder">the border mode for gradients.</param>
/// <param name="tryReuseInputImage">put ROI of input image into the pyramid if possible.
/// You can pass false to force data copying.</param>
/// <returns>number of levels in constructed pyramid. Can be less than maxLevel.</returns>
public static int BuildOpticalFlowPyramid(
InputArray img, OutputArray pyramid,
Size winSize, int maxLevel,
bool withDerivatives = true,
BorderTypes pyrBorder = BorderTypes.Reflect101,
BorderTypes derivBorder = BorderTypes.Constant,
bool tryReuseInputImage = true)
{
if (img == null)
throw new ArgumentNullException("img");
if (pyramid == null)
throw new ArgumentNullException("pyramid");
img.ThrowIfDisposed();
pyramid.ThrowIfNotReady();
int result = NativeMethods.video_buildOpticalFlowPyramid1(
img.CvPtr, pyramid.CvPtr, winSize, maxLevel, withDerivatives ? 1 : 0,
(int)pyrBorder, (int)derivBorder, tryReuseInputImage ? 1 : 0);
pyramid.Fix();
return result;
}
示例14: MeanStdDev
/// <summary>
/// computes mean value and standard deviation of all or selected array elements
/// </summary>
/// <param name="src">The source array; it should have 1 to 4 channels
/// (so that the results can be stored in Scalar's)</param>
/// <param name="mean">The output parameter: computed mean value</param>
/// <param name="stddev">The output parameter: computed standard deviation</param>
/// <param name="mask">The optional operation mask</param>
public static void MeanStdDev(
InputArray src, OutputArray mean, OutputArray stddev, InputArray mask = null)
{
if (src == null)
throw new ArgumentNullException("src");
if (mean == null)
throw new ArgumentNullException("mean");
if (stddev == null)
throw new ArgumentNullException("stddev");
src.ThrowIfDisposed();
mean.ThrowIfNotReady();
stddev.ThrowIfNotReady();
NativeMethods.core_meanStdDev_OutputArray(src.CvPtr, mean.CvPtr, stddev.CvPtr, ToPtr(mask));
mean.Fix();
stddev.Fix();
GC.KeepAlive(src);
GC.KeepAlive(mask);
}
示例15: FindNonZero
/// <summary>
/// returns the list of locations of non-zero pixels
/// </summary>
/// <param name="src"></param>
/// <param name="idx"></param>
public static void FindNonZero(InputArray src, OutputArray idx)
{
if (src == null)
throw new ArgumentNullException("src");
if (idx == null)
throw new ArgumentNullException("idx");
src.ThrowIfDisposed();
idx.ThrowIfNotReady();
NativeMethods.core_findNonZero(src.CvPtr, idx.CvPtr);
GC.KeepAlive(src);
idx.Fix();
}