本文整理汇总了C#中ManagedCuda.NPP.NPPImage_16uC1类的典型用法代码示例。如果您正苦于以下问题:C# NPPImage_16uC1类的具体用法?C# NPPImage_16uC1怎么用?C# NPPImage_16uC1使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NPPImage_16uC1类属于ManagedCuda.NPP命名空间,在下文中一共展示了NPPImage_16uC1类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThresholdLTGT
/// <summary>
/// Image threshold.<para/>
/// If for a comparison operations sourcePixel is less than nThresholdLT is true, the pixel is set
/// to nValueLT, else if sourcePixel is greater than nThresholdGT the pixel is set to nValueGT, otherwise it is set to sourcePixel.
/// </summary>
/// <param name="dest">Destination image</param>
/// <param name="nThresholdLT">The thresholdLT value.</param>
/// <param name="nValueLT">The thresholdLT replacement value.</param>
/// <param name="nThresholdGT">The thresholdGT value.</param>
/// <param name="nValueGT">The thresholdGT replacement value.</param>
public void ThresholdLTGT(NPPImage_16uC1 dest, ushort nThresholdLT, ushort nValueLT, ushort nThresholdGT, ushort nValueGT)
{
status = NPPNativeMethods.NPPi.Threshold.nppiThreshold_LTValGTVal_16u_C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nThresholdLT, nValueLT, nThresholdGT, nValueGT);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiThreshold_LTValGTVal_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例2: Resize
/// <summary>
/// resizes planar images.
/// </summary>
/// <param name="src0">Source image (Channel 0)</param>
/// <param name="src1">Source image (Channel 1)</param>
/// <param name="src2">Source image (Channel 2)</param>
/// <param name="dest0">Destination image (Channel 0)</param>
/// <param name="dest1">Destination image (Channel 1)</param>
/// <param name="dest2">Destination image (Channel 2)</param>
/// <param name="xFactor">X scaling factor</param>
/// <param name="yFactor">Y scaling factor</param>
/// <param name="eInterpolation">Interpolation mode</param>
public static void Resize(NPPImage_16uC1 src0, NPPImage_16uC1 src1, NPPImage_16uC1 src2, NPPImage_16uC1 dest0, NPPImage_16uC1 dest1, NPPImage_16uC1 dest2, double xFactor, double yFactor, InterpolationMode eInterpolation)
{
CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer };
CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointerRoi, dest1.DevicePointerRoi, dest2.DevicePointerRoi };
NppStatus status = NPPNativeMethods.NPPi.GeometricTransforms.nppiResize_16u_P3R(src, src0.Size, src0.Pitch, new NppiRect(src0.PointRoi, src0.SizeRoi), dst, dest0.Pitch, dest0.SizeRoi, xFactor, yFactor, eInterpolation);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiResize_16u_P3R", status));
NPPException.CheckNppStatus(status, null);
}
示例3: Remap
/// <summary>
/// planar image remap.
/// </summary>
/// <param name="src0">Source image (Channel 0)</param>
/// <param name="src1">Source image (Channel 1)</param>
/// <param name="src2">Source image (Channel 2)</param>
/// <param name="dest0">Destination image (Channel 0)</param>
/// <param name="dest1">Destination image (Channel 1)</param>
/// <param name="dest2">Destination image (Channel 2)</param>
/// <param name="pXMap">Device memory pointer to 2D image array of X coordinate values to be used when sampling source image. </param>
/// <param name="pYMap">Device memory pointer to 2D image array of Y coordinate values to be used when sampling source image. </param>
/// <param name="eInterpolation">The type of eInterpolation to perform resampling.</param>
public static void Remap(NPPImage_16uC1 src0, NPPImage_16uC1 src1, NPPImage_16uC1 src2, NPPImage_16uC1 dest0, NPPImage_16uC1 dest1, NPPImage_16uC1 dest2, NPPImage_32fC1 pXMap, NPPImage_32fC1 pYMap, InterpolationMode eInterpolation)
{
CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer };
CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointerRoi, dest1.DevicePointerRoi, dest2.DevicePointerRoi };
NppiRect srcRect = new NppiRect(src0.PointRoi, src0.SizeRoi);
NppStatus status = NPPNativeMethods.NPPi.Remap.nppiRemap_16u_P3R(src, src0.SizeRoi, src0.Pitch, srcRect, pXMap.DevicePointerRoi, pXMap.Pitch, pYMap.DevicePointerRoi, pYMap.Pitch, dst, dest0.Pitch, dest0.SizeRoi, eInterpolation);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiRemap_16u_P3R", status));
NPPException.CheckNppStatus(status, null);
}
示例4: Copy
/// <summary>
/// Image copy.
/// </summary>
/// <param name="dst">Destination image</param>
/// <param name="channel">Channel number. This number is added to the dst pointer</param>
public void Copy(NPPImage_16uC1 dst, int channel)
{
if (channel < 0 | channel >= _channels) throw new ArgumentOutOfRangeException("channel", "channel must be in range [0..2].");
status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_16u_C3C1R(_devPtrRoi + channel * _typeSize, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_16u_C3C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例5: Div
/// <summary>
/// In place image division, scale by 2^(-nScaleFactor), then clamp to saturated value.
/// </summary>
/// <param name="src2">2nd source image</param>
/// <param name="nScaleFactor">scaling factor</param>
public void Div(NPPImage_16uC1 src2, int nScaleFactor)
{
status = NPPNativeMethods.NPPi.Div.nppiDiv_16u_C1IRSfs(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_16u_C1IRSfs", status));
NPPException.CheckNppStatus(status, this);
}
示例6: Convert
/// <summary>
/// 32-bit unsigned to 16-bit unsigned conversion.
/// </summary>
/// <param name="dst">Destination image</param>
/// <param name="roundMode">Round mode</param>
/// <param name="scaleFactor">scaling factor</param>
public void Convert(NPPImage_16uC1 dst, NppRoundMode roundMode, int scaleFactor)
{
status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32u16u_C1RSfs(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, roundMode, scaleFactor);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32u16u_C1RSfs", status));
NPPException.CheckNppStatus(status, this);
}
示例7: Compare
/// <summary>
/// Compare pSrc1's pixels with corresponding pixels in pSrc2.
/// </summary>
/// <param name="src2">2nd source image</param>
/// <param name="dest">Destination image</param>
/// <param name="eComparisonOperation">Specifies the comparison operation to be used in the pixel comparison.</param>
public void Compare(NPPImage_16uC1 src2, NPPImage_8uC1 dest, NppCmpOp eComparisonOperation)
{
status = NPPNativeMethods.NPPi.Compare.nppiCompare_16u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, eComparisonOperation);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCompare_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例8: Copy
/// <summary>
/// Masked Operation 8-bit unsigned image copy.
/// </summary>
/// <param name="dst">Destination image</param>
/// <param name="mask">Mask image</param>
public void Copy(NPPImage_16uC1 dst, NPPImage_8uC1 mask)
{
status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_16u_C1MR(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, mask.DevicePointerRoi, mask.Pitch);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_16u_C1MR", status));
NPPException.CheckNppStatus(status, this);
}
示例9: Xor
/// <summary>
/// In place image logical Xor.
/// </summary>
/// <param name="src2">2nd source image</param>
public void Xor(NPPImage_16uC1 src2)
{
status = NPPNativeMethods.NPPi.Xor.nppiXor_16u_C1IR(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiXor_16u_C1IR", status));
NPPException.CheckNppStatus(status, this);
}
示例10: ColorTwist
/// <summary>
/// An input color twist matrix with floating-point pixel values is applied
/// within ROI.
/// </summary>
/// <param name="dest">Destination image</param>
/// <param name="twistMatrix">The color twist matrix with floating-point pixel values [3,4].</param>
public void ColorTwist(NPPImage_16uC1 dest, float[,] twistMatrix)
{
status = NPPNativeMethods.NPPi.ColorProcessing.nppiColorTwist32f_16u_C1R(_devPtr, _pitch, dest.DevicePointer, dest.Pitch, _sizeRoi, twistMatrix);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例11: WarpPerspectiveQuad
/// <summary>
/// Perspective transform of an image.<para/>
/// This function performs perspective warping of a the specified
/// quadrangle in the source image to the specified quadrangle in the
/// destination image. The function nppiWarpPerspectiveQuad uses the same
/// formulas for pixel mapping as in nppiWarpPerspective function. The
/// transform coefficients are computed internally.
/// The transformed part of the source image is resampled using the specified
/// interpolation method and written to the destination ROI.<para/>
/// NPPI specific recommendation: <para/>
/// The function operates using 2 types of kernels: fast and accurate. The fast
/// method is about 4 times faster than its accurate variant,
/// but doesn't perform memory access checks and requires the destination ROI
/// to be 64 bytes aligned. Hence any destination ROI is
/// chunked into 3 vertical stripes: the first and the third are processed by
/// accurate kernels and the central one is processed by the fast one.
/// In order to get the maximum available speed of execution, the projection of
/// destination ROI onto image addresses must be 64 bytes aligned. This is
/// always true if the values <para/>
/// <code>(int)((void *)(pDst + dstRoi.x))</code> and <para/>
/// <code>(int)((void *)(pDst + dstRoi.x + dstRoi.width))</code> <para/>
/// are multiples of 64. Another rule of thumb is to specify destination ROI in
/// such way that left and right sides of the projected image are separated from
/// the ROI by at least 63 bytes from each side. However, this requires the
/// whole ROI to be part of allocated memory. In case when the conditions above
/// are not satisfied, the function may decrease in speed slightly and will
/// return NPP_MISALIGNED_DST_ROI_WARNING warning.
/// </summary>
/// <param name="srcQuad">Source quadrangle [4,2]</param>
/// <param name="dest">Destination image</param>
/// <param name="destQuad">Destination quadrangle [4,2]</param>
/// <param name="eInterpolation">Interpolation mode: can be <see cref="InterpolationMode.NearestNeighbor"/>, <see cref="InterpolationMode.Linear"/> or <see cref="InterpolationMode.Cubic"/></param>
public void WarpPerspectiveQuad(double[,] srcQuad, NPPImage_16uC1 dest, double[,] destQuad, InterpolationMode eInterpolation)
{
NppiRect rectIn = new NppiRect(_pointRoi, _sizeRoi);
NppiRect rectOut = new NppiRect(dest.PointRoi, dest.SizeRoi);
status = NPPNativeMethods.NPPi.PerspectiveTransforms.nppiWarpPerspectiveQuad_16u_C1R(_devPtr, _sizeOriginal, _pitch, rectIn, srcQuad, dest.DevicePointer, dest.Pitch, rectOut, destQuad, eInterpolation);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiWarpPerspectiveQuad_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例12: AverageRelativeError
/// <summary>
/// image average relative error.
/// </summary>
/// <param name="src2">2nd source image</param>
/// <param name="pError">Pointer to the computed error.</param>
/// <param name="buffer">Pointer to the user-allocated scratch buffer required for the AverageRelativeError operation.</param>
public void AverageRelativeError(NPPImage_16uC1 src2, CudaDeviceVariable<double> pError, CudaDeviceVariable<byte> buffer)
{
int bufferSize = AverageRelativeErrorGetBufferHostSize();
if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small.");
status = NPPNativeMethods.NPPi.AverageRelativeError.nppiAverageRelativeError_16u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例13: Transpose
/// <summary>
/// image transpose
/// </summary>
/// <param name="dest">Destination image</param>
public void Transpose(NPPImage_16uC1 dest)
{
status = NPPNativeMethods.NPPi.Transpose.nppiTranspose_16u_C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiTranspose_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例14: Dilate3x3Border
/// <summary>
/// 3x3 dilation with border control.
/// </summary>
/// <param name="dest">Destination image</param>
/// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
public void Dilate3x3Border(NPPImage_16uC1 dest, NppiBorderType eBorderType)
{
status = NPPNativeMethods.NPPi.Dilate3x3Border.nppiDilate3x3Border_16u_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, eBorderType);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDilate3x3Border_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}
示例15: CopySubpix
/// <summary>
/// linearly interpolated source image subpixel coordinate color copy.
/// </summary>
/// <param name="dst">Destination-Image</param>
/// <param name="nDx">Fractional part of source image X coordinate.</param>
/// <param name="nDy">Fractional part of source image Y coordinate.</param>
public void CopySubpix(NPPImage_16uC1 dst, float nDx, float nDy)
{
status = NPPNativeMethods.NPPi.CopySubpix.nppiCopySubpix_16u_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nDx, nDy);
Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopySubpix_16u_C1R", status));
NPPException.CheckNppStatus(status, this);
}