/// <summary>
        /// image average 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 AverageRelativeError(NPPImage_32uC1 src2, CudaDeviceVariable <double> pError)
        {
            int bufferSize = AverageRelativeErrorGetBufferHostSize();
            CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize);

            status = NPPNativeMethods.NPPi.AverageRelativeError.nppiAverageRelativeError_32u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_32u_C1R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
        /// <summary>
        /// One-channel 32-bit unsigned 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. (1 * sizeof(double))</param>
        public void DotProduct(NPPImage_32uC1 src2, CudaDeviceVariable <double> pDp)
        {
            int bufferSize = DotProdGetBufferHostSize();
            CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize);

            status = NPPNativeMethods.NPPi.DotProd.nppiDotProd_32u64f_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pDp.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDotProd_32u64f_C1R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
        /// <summary>
        /// image maximum 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>
        /// <param name="nppStreamCtx">NPP stream context.</param>
        public void MaxError(NPPImage_32uC1 src2, CudaDeviceVariable <double> pError, NppStreamContext nppStreamCtx)
        {
            int bufferSize = MaxErrorGetBufferHostSize(nppStreamCtx);
            CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize);

            status = NPPNativeMethods_Ctx.NPPi.MaximumError.nppiMaximumError_32u_C1R_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer, nppStreamCtx);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumError_32u_C1R_Ctx", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
        /// <summary>
        /// image maximum 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 MaximumRelativeError operation.</param>
        public void MaximumRelativeError(NPPImage_32uC1 src2, CudaDeviceVariable <double> pError, CudaDeviceVariable <byte> buffer)
        {
            int bufferSize = MaximumRelativeErrorGetBufferHostSize();

            if (bufferSize > buffer.Size)
            {
                throw new NPPException("Provided buffer is too small.");
            }

            status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_32u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_32u_C1R", status));
            NPPException.CheckNppStatus(status, this);
        }
        /// <summary>
        /// One-channel 32-bit unsigned image DotProd.
        /// </summary>
        /// <param name="src2">2nd source image</param>
        /// <param name="pDp">Pointer to the computed dot product of the two images. (1 * sizeof(double))</param>
        /// <param name="buffer">Allocated device memory with size of at <see cref="DotProdGetBufferHostSize()"/></param>
        /// <param name="nppStreamCtx">NPP stream context.</param>
        public void DotProduct(NPPImage_32uC1 src2, CudaDeviceVariable <double> pDp, CudaDeviceVariable <byte> buffer, NppStreamContext nppStreamCtx)
        {
            int bufferSize = DotProdGetBufferHostSize(nppStreamCtx);

            if (bufferSize > buffer.Size)
            {
                throw new NPPException("Provided buffer is too small.");
            }

            status = NPPNativeMethods_Ctx.NPPi.DotProd.nppiDotProd_32u64f_C1R_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pDp.DevicePointer, buffer.DevicePointer, nppStreamCtx);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDotProd_32u64f_C1R_Ctx", status));
            NPPException.CheckNppStatus(status, this);
        }
 /// <summary>
 /// 1 channel 32-bit to 32-bit unsigned integer label markers image generation.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="eNorm">Type of pixel connectivity test to use, nppiNormInf will use 8 way connectivity and nppiNormL1 will use 4 way connectivity. </param>
 /// <param name="pBuffer">Pointer to device memory scratch buffer at least as large as value returned by the corresponding LabelMarkersUFGetBufferSize call.</param>
 public void LabelMarkersUF(NPPImage_32uC1 dest, NppiNorm eNorm, CudaDeviceVariable <byte> pBuffer)
 {
     status = NPPNativeMethods.NPPi.LabelMarkers.nppiLabelMarkersUF_32u_C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, eNorm, pBuffer.DevicePointer);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLabelMarkersUF_32u_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>
		/// 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_32uC1 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_32u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_32u_C1R", 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_32uC1 src2, CudaDeviceVariable<double> pError)
		{
			int bufferSize = MaximumRelativeErrorGetBufferHostSize();
			CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);
			status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_32u_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_32u_C1R", status));
			buffer.Dispose();
			NPPException.CheckNppStatus(status, this);
		}
		/// <summary>
		/// One-channel 32-bit unsigned 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. (1 * sizeof(double))</param>
		public void DotProduct(NPPImage_32uC1 src2, CudaDeviceVariable<double> pDp)
		{
			int bufferSize = DotProdGetBufferHostSize();
			CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

			status = NPPNativeMethods.NPPi.DotProd.nppiDotProd_32u64f_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pDp.DevicePointer, buffer.DevicePointer);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDotProd_32u64f_C1R", status));
			buffer.Dispose();
			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 signed to 32-bit unsigned conversion.
		/// </summary>
		/// <param name="dst">Destination image</param>
		public void Convert(NPPImage_32uC1 dst)
		{
			status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_32s32u_C1Rs(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_32s32u_C1Rs", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemple #13
0
 /// <summary>
 /// One channel 8-bit unsigned bit range restricted 32-bit palette look-up-table color conversion with 32-bit destination output per pixel.
 /// The LUT is derived from a set of user defined mapping points in a palette and 
 /// source pixels are then processed using a restricted bit range when looking up palette values.
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="pTable">Pointer to an array of user defined OUTPUT palette values (4 bytes per pixel)</param>
 /// <param name="nBitSize">Number of least significant bits (must be &gt; 0 and &lt;= 16) of each source pixel value to use as index into palette table during conversion.</param>
 public void LUTPalette(NPPImage_32uC1 dst, CudaDeviceVariable<uint> pTable, int nBitSize)
 {
     status = NPPNativeMethods.NPPi.ColorLUTPalette.nppiLUTPalette_16u32u_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pTable.DevicePointer, nBitSize);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLUTPalette_16u32u_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }