/// <summary> /// 32-bit signed to 8-bit signed conversion. /// </summary> /// <param name="dst">Destination image</param> public void Convert(NPPImage_8sC3 dst) { status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32s8s_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32s8s_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// CrossCorrValid_NormLevel. Buffer is internally allocated and freed. /// </summary> /// <param name="tpl">template image.</param> /// <param name="dst">Destination image</param> public void CrossCorrValid_NormLevel(NPPImage_8sC3 tpl, NPPImage_32fC3 dst) { int bufferSize = ValidNormLevelGetBufferHostSize(); CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize); status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_NormLevel_8s32f_C3R(_devPtrRoi, _pitch, _sizeRoi, tpl.DevicePointerRoi, tpl.Pitch, tpl.SizeRoi, dst.DevicePointer, dst.Pitch, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCrossCorrValid_NormLevel_8s32f_C3R", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image CrossCorrValid_Norm. /// </summary> /// <param name="tpl">template image.</param> /// <param name="dst">Destination-Image</param> public void CrossCorrValid_Norm(NPPImage_8sC3 tpl, NPPImage_32fC3 dst) { status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_Norm_8s32f_C3R(_devPtrRoi, _pitch, _sizeRoi, tpl.DevicePointerRoi, tpl.Pitch, tpl.SizeRoi, dst.DevicePointerRoi, dst.Pitch); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCrossCorrValid_Norm_8s32f_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <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_8sC3 dest, float[,] twistMatrix) { status = NPPNativeMethods.NPPi.ColorTwist.nppiColorTwist32f_8s_C3R(_devPtr, _pitch, dest.DevicePointer, dest.Pitch, _sizeRoi, twistMatrix); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_8s_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// CrossCorrSame_NormLevel. /// </summary> /// <param name="tpl">template image.</param> /// <param name="dst">Destination image</param> /// <param name="buffer">Allocated device memory with size of at <see cref="SameNormLevelGetBufferHostSize()"/></param> public void CrossCorrSame_NormLevel(NPPImage_8sC3 tpl, NPPImage_32fC3 dst, CudaDeviceVariable<byte> buffer) { int bufferSize = SameNormLevelGetBufferHostSize(); if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small."); status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrSame_NormLevel_8s32f_C3R(_devPtrRoi, _pitch, _sizeRoi, tpl.DevicePointerRoi, tpl.Pitch, tpl.SizeRoi, dst.DevicePointer, dst.Pitch, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCrossCorrSame_NormLevel_8s32f_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image bit shift by constant (right). /// </summary> /// <param name="nConstant">Constant</param> /// <param name="dest">Destination image</param> public void RShiftC(uint[] nConstant, NPPImage_8sC3 dest) { status = NPPNativeMethods.NPPi.RightShiftConst.nppiRShiftC_8s_C3R(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiRShiftC_8s_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Three-channel 8-bit signed image DotProd. Buffer is internally allocated and freed. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pDp">Pointer to the computed dot product of the two images. (3 * sizeof(double))</param> public void DotProduct(NPPImage_8sC3 src2, CudaDeviceVariable<double> pDp) { int bufferSize = DotProdGetBufferHostSize(); CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize); status = NPPNativeMethods.NPPi.DotProd.nppiDotProd_8s64f_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pDp.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDotProd_8s64f_C3R", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <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_8sC3 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_8s_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_8s_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image maximum relative error. User buffer is internally allocated and freed. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="pError">Pointer to the computed error.</param> public void MaximumRelativeError(NPPImage_8sC3 src2, CudaDeviceVariable<double> pError) { int bufferSize = MaximumRelativeErrorGetBufferHostSize(); CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize); status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_8s_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_8s_C3R", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <summary> /// convolution filter. /// </summary> /// <param name="dst">Destination-Image</param> /// <param name="pKernel">Pointer to the start address of the kernel coefficient array.<para/> /// Coefficients are expected to be stored in reverse order.</param> /// <param name="oKernelSize">Width and Height of the rectangular kernel.</param> /// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference</param> public void Filter(NPPImage_8sC3 dst, CudaDeviceVariable<float> pKernel, NppiSize oKernelSize, NppiPoint oAnchor) { status = NPPNativeMethods.NPPi.Convolution.nppiFilter32f_8s_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, oKernelSize, oAnchor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilter32f_8s_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image NormRel_L2. Buffer is internally allocated and freed. /// </summary> /// <param name="tpl">template image.</param> /// <param name="pNormRel">Pointer to the computed relative error for the infinity norm of two images. (1 * sizeof(double))</param> /// <param name="nCOI">channel of interest.</param> /// <param name="pMask">Mask image.</param> public void NormRel_L2(NPPImage_8sC3 tpl, CudaDeviceVariable<double> pNormRel, int nCOI, NPPImage_8uC1 pMask) { int bufferSize = NormRelL2MaskedGetBufferHostSize(); CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize); status = NPPNativeMethods.NPPi.NormRel.nppiNormRel_L2_8s_C3CMR(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, pMask.DevicePointerRoi, pMask.Pitch, _sizeRoi, nCOI, pNormRel.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormRel_L2_8s_C3CMR", status)); buffer.Dispose(); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image NormRel_L1. /// </summary> /// <param name="tpl">template image.</param> /// <param name="pNormRel">Pointer to the computed relative error for the infinity norm of two images. (1 * sizeof(double))</param> /// <param name="nCOI">channel of interest.</param> /// <param name="pMask">Mask image.</param> /// <param name="buffer">Allocated device memory with size of at <see cref="NormRelL1MaskedGetBufferHostSize()"/></param> public void NormRel_L1(NPPImage_8sC3 tpl, CudaDeviceVariable<double> pNormRel, int nCOI, NPPImage_8uC1 pMask, CudaDeviceVariable<byte> buffer) { int bufferSize = NormRelL1MaskedGetBufferHostSize(); if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small."); status = NPPNativeMethods.NPPi.NormRel.nppiNormRel_L1_8s_C3CMR(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, pMask.DevicePointerRoi, pMask.Pitch, _sizeRoi, nCOI, pNormRel.DevicePointer, buffer.DevicePointer); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormRel_L1_8s_C3CMR", status)); NPPException.CheckNppStatus(status, this); }