/// <summary> /// 16-bit floating point to 32-bit conversion. /// </summary> /// <param name="dst">Destination image</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Convert(NPPImage_32fC3 dst, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.BitDepthConversion.nppiConvert_16f32f_C3R_Ctx(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_16f32f_C3R_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// 4 channel 16-bit floating point in place color twist with 4x4 matrix and an additional constant vector addition. /// An input 4x4 color twist matrix with floating-point coefficient values with an additional constant vector addition /// is applied within ROI. For this particular version of the function the result is generated as shown below. /// \code /// dst[0] = aTwist[0][0] /// src[0] + aTwist[0][1] /// src[1] + aTwist[0][2] /// src[2] + aTwist[0][3] /// src[3] + aConstants[0] /// dst[1] = aTwist[1][0] /// src[0] + aTwist[1][1] /// src[1] + aTwist[1][2] /// src[2] + aTwist[1][3] /// src[3] + aConstants[1] /// dst[2] = aTwist[2][0] /// src[0] + aTwist[2][1] /// src[1] + aTwist[2][2] /// src[2] + aTwist[2][3] /// src[3] + aConstants[2] /// dst[3] = aTwist[3][0] /// src[0] + aTwist[3][1] /// src[1] + aTwist[3][2] /// src[2] + aTwist[3][3] /// src[3] + aConstants[3] /// \endcode /// </summary> /// <param name="twistMatrix">The color twist matrix with floating-point coefficient values [4,4].</param> /// <param name="aConstants">fixed size array of constant values, one per channel [4]</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void ColorTwistC(float[,] twistMatrix, float[] aConstants, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.ColorTwist.nppiColorTwist32fC_16f_C4IR_Ctx(_devPtr, _pitch, _sizeRoi, twistMatrix, aConstants, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32fC_16f_C4IR_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image. Inplace. /// </summary> /// <param name="nConstant">Value</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Div(float[] nConstant, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.DivConst.nppiDivC_16f_C4IR_Ctx(nConstant, _devPtrRoi, _pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_16f_C4IR_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// In place image multiplication, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="nScaleFactor">scaling factor</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void MulA(NPPImage_16scC4 src2, int nScaleFactor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Mul.nppiMul_16sc_AC4IRSfs_Ctx(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMul_16sc_AC4IRSfs_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="nConstant">Value</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void DivA(Npp16sc[] nConstant, NPPImage_16scC4 dest, int nScaleFactor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.DivConst.nppiDivC_16sc_AC4RSfs_Ctx(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_16sc_AC4RSfs_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image multiplication. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="dest">Destination image</param> public void Mul(NPPImage_32fcC3 src2, NPPImage_32fcC3 dest) { status = NPPNativeMethods.NPPi.Mul.nppiMul_32fc_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMul_32fc_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image. /// </summary> /// <param name="nConstant">Value</param> /// <param name="dest">Destination image</param> public void Div(Npp32fc[] nConstant, NPPImage_32fcC3 dest) { status = NPPNativeMethods.NPPi.DivConst.nppiDivC_32fc_C3R(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32fc_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// 1 channel 32-bit unsigned integer in place region boundary border image generation. /// </summary> /// <param name="nBorderVal">Pixel value to be used at connected region boundary borders</param> public void BoundSegments(uint nBorderVal) { status = NPPNativeMethods.NPPi.LabelMarkers.nppiBoundSegments_32u_C1IR(_devPtrRoi, _pitch, _sizeRoi, nBorderVal); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiBoundSegments_32u_C1IR", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// /// </summary> /// <param name="error"></param> public NPPWarning(NppStatus error) : base(NPPException.GetErrorMessageFromNppStatus(error)) { this._nppError = error; }
/// <summary> /// 32-bit unsigned to 32-bit float conversion. /// </summary> /// <param name="dst">Destination image</param> public void Convert(NPPImage_32fC1 dst) { status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32u32f_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32u32f_C1R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image composition using constant alpha. /// </summary> /// <param name="alpha1">constant alpha for this image</param> /// <param name="src2">2nd source image</param> /// <param name="alpha2">constant alpha for src2</param> /// <param name="dest">Destination image</param> /// <param name="nppAlphaOp">alpha compositing operation</param> public void AlphaComp(uint alpha1, NPPImage_32uC1 src2, ushort alpha2, NPPImage_32uC1 dest, NppiAlphaOp nppAlphaOp) { status = NPPNativeMethods.NPPi.AlphaCompConst.nppiAlphaCompC_32u_C1R(_devPtrRoi, _pitch, alpha1, src2.DevicePointerRoi, src2.Pitch, alpha2, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nppAlphaOp); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAlphaCompC_32u_C1R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// 32-bit unsigned to 32-bit signed conversion. /// </summary> /// <param name="dst">Destination image</param> /// <param name="roundMode">Round mode</param> /// <param name="scaleFactor">scaling factor</param> public void Convert(NPPImage_32sC1 dst, NppRoundMode roundMode, int scaleFactor) { status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32u32s_C1RSfs(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, roundMode, scaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32u32s_C1RSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Resizes images. /// </summary> /// <param name="dest">Destination image</param> /// <param name="eInterpolation">Interpolation mode</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Resize(NPPImage_16fC3 dest, InterpolationMode eInterpolation, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.GeometricTransforms.nppiResize_16f_C3R_Ctx(_devPtr, _pitch, _sizeOriginal, new NppiRect(_pointRoi, _sizeRoi), dest.DevicePointer, dest.Pitch, dest.Size, new NppiRect(dest.PointRoi, dest.SizeRoi), eInterpolation, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiResize_16f_C3R_Ctx", status)); 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> /// <param name="nppStreamCtx">NPP stream context.</param> public void Filter(NPPImage_16fC3 dst, CudaDeviceVariable <float> pKernel, NppiSize oKernelSize, NppiPoint oAnchor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Convolution.nppiFilter32f_16f_C3R_Ctx(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, oKernelSize, oAnchor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilter32f_16f_C3R_Ctx", 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> /// <param name="nppStreamCtx">NPP stream context.</param> public void ColorTwist(NPPImage_16fC2 dest, float[,] twistMatrix, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.ColorTwist.nppiColorTwist32f_16f_C2R_Ctx(_devPtr, _pitch, dest.DevicePointer, dest.Pitch, _sizeRoi, twistMatrix, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_16f_C2R_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// image copy. Not affecting Alpha channel. /// </summary> /// <param name="dst">Destination image</param> public void CopyA(NPPImage_32scC4 dst) { status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32sc_AC4R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32sc_AC4R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Set pixel values to nValue. /// </summary> /// <param name="nValue">Value to be set</param> public void Set(Npp32fc[] nValue) { status = NPPNativeMethods.NPPi.MemSet.nppiSet_32fc_C3R(nValue, _devPtrRoi, _pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSet_32fc_C3R", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image subtraction, scale by 2^(-nScaleFactor), then clamp to saturated value. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> public void Sub(NPPImage_32scC4 src2, NPPImage_32scC4 dest, int nScaleFactor) { status = NPPNativeMethods.NPPi.Sub.nppiSub_32sc_C4RSfs(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSub_32sc_C4RSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// In place image division. /// </summary> /// <param name="src2">2nd source image</param> public void Div(NPPImage_32fcC3 src2) { status = NPPNativeMethods.NPPi.Div.nppiDiv_32fc_C3IR(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32fc_C3IR", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Multiply constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="nConstant">Value</param> /// <param name="dest">Destination image</param> /// <param name="nScaleFactor">scaling factor</param> public void MulA(Npp32sc[] nConstant, NPPImage_32scC4 dest, int nScaleFactor) { status = NPPNativeMethods.NPPi.MulConst.nppiMulC_32sc_AC4RSfs(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMulC_32sc_AC4RSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image. Inplace. /// </summary> /// <param name="nConstant">Value</param> public void Div(Npp32fc[] nConstant) { status = NPPNativeMethods.NPPi.DivConst.nppiDivC_32fc_C3IR(nConstant, _devPtrRoi, _pitch, _sizeRoi); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32fc_C3IR", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// In place image division, scale by 2^(-nScaleFactor), then clamp to saturated value. Unchanged Alpha. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="nScaleFactor">scaling factor</param> public void DivA(NPPImage_32scC4 src2, int nScaleFactor) { status = NPPNativeMethods.NPPi.Div.nppiDiv_32sc_AC4IRSfs(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_32sc_AC4IRSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Multiply constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Inplace. Unchanged Alpha. /// </summary> /// <param name="nConstant">Value</param> /// <param name="nScaleFactor">scaling factor</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void MulA(Npp16sc[] nConstant, int nScaleFactor, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.MulConst.nppiMulC_16sc_AC4IRSfs_Ctx(nConstant, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMulC_16sc_AC4IRSfs_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Divide constant to image, scale by 2^(-nScaleFactor), then clamp to saturated value. Inplace. Unchanged Alpha. /// </summary> /// <param name="nConstant">Value</param> /// <param name="nScaleFactor">scaling factor</param> public void DivA(Npp32sc[] nConstant, int nScaleFactor) { status = NPPNativeMethods.NPPi.DivConst.nppiDivC_32sc_AC4IRSfs(nConstant, _devPtrRoi, _pitch, _sizeRoi, nScaleFactor); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32sc_AC4IRSfs", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Set pixel values to nValue. <para/> /// The 8-bit mask image affects setting of the respective pixels in the destination image. <para/> /// If the mask value is zero (0) the pixel is not set, if the mask is non-zero, the corresponding /// destination pixel is set to specified value. Not affecting alpha channel. /// </summary> /// <param name="nValue">Value to be set (Array size = 3)</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void SetA(Npp16sc[] nValue, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.MemSet.nppiSet_16sc_AC4R_Ctx(nValue, _devPtrRoi, _pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSet_16sc_AC4R_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// in place color twist. /// /// An input color twist matrix with floating-point coefficient values is applied /// within ROI. /// </summary> /// <param name="aTwist">The color twist matrix with floating-point coefficient values. [3,4]</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void ColorTwist(float[,] aTwist, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.ColorProcessing.nppiColorTwist32f_16s_C2IR_Ctx(_devPtr, _pitch, _sizeRoi, aTwist, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_16s_C2IR_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// In place image division. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Div(NPPImage_16fC4 src2, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Div.nppiDiv_16f_C4IR_Ctx(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDiv_16f_C4IR_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image composition using image alpha values (0 - max channel pixel value).<para/> /// Also the function is called *AC1R, it is a two channel image with second channel as alpha. /// </summary> /// <param name="src2">2nd source image</param> /// <param name="dest">Destination image</param> /// <param name="nppAlphaOp">alpha compositing operation</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void AlphaComp(NPPImage_16sC2 src2, NPPImage_16sC2 dest, NppiAlphaOp nppAlphaOp, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.AlphaComp.nppiAlphaComp_16s_AC1R_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nppAlphaOp, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAlphaComp_16s_AC1R_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Image squared. /// </summary> /// <param name="dest">Destination image</param> /// <param name="nppStreamCtx">NPP stream context.</param> public void Sqr(NPPImage_16fC4 dest, NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Sqr.nppiSqr_16f_C4R_Ctx(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSqr_16f_C4R_Ctx", status)); NPPException.CheckNppStatus(status, this); }
/// <summary> /// Inplace image square root. /// </summary> public void Sqrt(NppStreamContext nppStreamCtx) { status = NPPNativeMethods_Ctx.NPPi.Sqrt.nppiSqrt_16f_C3IR_Ctx(_devPtrRoi, _pitch, _sizeRoi, nppStreamCtx); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSqrt_16f_C3IR_Ctx", status)); NPPException.CheckNppStatus(status, this); }