Пример #1
0
        /// <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_8sC2 src2, CudaDeviceVariable <double> pError, NppStreamContext nppStreamCtx)
        {
            int bufferSize = MaxErrorGetBufferHostSize(nppStreamCtx);
            CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize);

            status = NPPNativeMethods_Ctx.NPPi.MaximumError.nppiMaximumError_8s_C2R_Ctx(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer, nppStreamCtx);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumError_8s_C2R_Ctx", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Пример #2
0
 /// <summary>
 /// Two channel 8-bit signed convolution filter with border control.<para/>
 /// General purpose 2D convolution filter using floating-point weights with border control.<para/>
 /// Pixels under the mask are multiplied by the respective weights in the mask
 /// and the results are summed. Before writing the result pixel the sum is scaled
 /// back via division by nDivisor. If any portion of the mask overlaps the source
 /// image boundary the requested border type operation is applied to all mask pixels
 /// which fall outside of the source image. <para/>
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="pKernel">Pointer to the start address of the kernel coefficient array. Coeffcients are expected to be stored in reverse order</param>
 /// <param name="nKernelSize">Width and Height of the rectangular kernel.</param>
 /// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference relative to the source pixel.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 /// <param name="filterArea">The area where the filter is allowed to read pixels. The point is relative to the ROI set to source image, the size is the total size starting from the filterArea point. Default value is the set ROI.</param>
 public void FilterBorder(NPPImage_8sC2 dest, CudaDeviceVariable <float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType, NppiRect filterArea = new NppiRect())
 {
     if (filterArea.Size == new NppiSize())
     {
         filterArea.Size = _sizeRoi;
     }
     status = NPPNativeMethods.NPPi.FilterBorder32f.nppiFilterBorder32f_8s_C2R(_devPtrRoi, _pitch, filterArea.Size, filterArea.Location, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, pKernel.DevicePointer, nKernelSize, oAnchor, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBorder32f_8s_C2R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #3
0
        /// <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_8sC2 src2, CudaDeviceVariable <double> pError)
        {
            int bufferSize = AverageRelativeErrorGetBufferHostSize();
            CudaDeviceVariable <byte> buffer = new CudaDeviceVariable <byte>(bufferSize);

            status = NPPNativeMethods.NPPi.AverageRelativeError.nppiAverageRelativeError_8s_C2R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_8s_C2R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Пример #4
0
        /// <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_8sC2 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_8s_C2R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_8s_C2R", status));
            NPPException.CheckNppStatus(status, this);
        }
Пример #5
0
 /// <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_8sC2 dst, CudaDeviceVariable <float> pKernel, NppiSize oKernelSize, NppiPoint oAnchor)
 {
     status = NPPNativeMethods.NPPi.Convolution.nppiFilter32f_8s_C2R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, oKernelSize, oAnchor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilter32f_8s_C2R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #6
0
 /// <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_8sC2 dest, float[,] twistMatrix)
 {
     status = NPPNativeMethods.NPPi.ColorProcessing.nppiColorTwist32f_8s_C2R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, twistMatrix);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_8s_C2R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #7
0
 /// <summary>
 /// Image composition using image alpha values (0 - max channel pixel value).
 /// 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>
 public void AlphaComp(NPPImage_8sC2 src2, NPPImage_8sC2 dest, NppiAlphaOp nppAlphaOp)
 {
     status = NPPNativeMethods.NPPi.AlphaComp.nppiAlphaComp_8s_AC1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nppAlphaOp);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAlphaComp_8s_AC1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #8
0
 /// <summary>
 /// Image copy.
 /// </summary>
 /// <param name="dst">Destination image</param>
 public void Copy(NPPImage_8sC2 dst)
 {
     status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_8s_C2R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_8s_C2R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #9
0
		/// <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_8sC2 dst, CudaDeviceVariable<float> pKernel, NppiSize oKernelSize, NppiPoint oAnchor)
		{
			status = NPPNativeMethods.NPPi.Convolution.nppiFilter32f_8s_C2R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, oKernelSize, oAnchor);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilter32f_8s_C2R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #10
0
		/// <summary>
		/// Two channel 8-bit signed convolution filter with border control.<para/>
		/// General purpose 2D convolution filter using floating-point weights with border control.<para/>
		/// Pixels under the mask are multiplied by the respective weights in the mask
		/// and the results are summed. Before writing the result pixel the sum is scaled
		/// back via division by nDivisor. If any portion of the mask overlaps the source
		/// image boundary the requested border type operation is applied to all mask pixels
		/// which fall outside of the source image. <para/>
		/// </summary>
		/// <param name="dest">Destination image</param>
		/// <param name="pKernel">Pointer to the start address of the kernel coefficient array. Coeffcients are expected to be stored in reverse order</param>
		/// <param name="nKernelSize">Width and Height of the rectangular kernel.</param>
		/// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference relative to the source pixel.</param>
		/// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
		public void FilterBorder(NPPImage_8sC2 dest, CudaDeviceVariable<float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType)
		{
			status = NPPNativeMethods.NPPi.FilterBorder32f.nppiFilterBorder32f_8s_C2R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, pKernel.DevicePointer, nKernelSize, oAnchor, eBorderType);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBorder32f_8s_C2R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #11
0
		/// <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_8sC2 dest, float[,] twistMatrix)
		{
			status = NPPNativeMethods.NPPi.ColorProcessing.nppiColorTwist32f_8s_C2R(_devPtr, _pitch, dest.DevicePointer, dest.Pitch, _sizeRoi, twistMatrix);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_8s_C2R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #12
0
		/// <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_8sC2 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_C2R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_8s_C2R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #13
0
		/// <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_8sC2 src2, CudaDeviceVariable<double> pError)
		{
			int bufferSize = MaximumRelativeErrorGetBufferHostSize();
			CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);
			status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_8s_C2R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_8s_C2R", status));
			buffer.Dispose();
			NPPException.CheckNppStatus(status, this);
		}
Пример #14
0
		/// <summary>
		/// Image composition using image alpha values (0 - max channel pixel value).
		/// 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>
		public void AlphaComp(NPPImage_8sC2 src2, NPPImage_8sC2 dest, NppiAlphaOp nppAlphaOp)
		{
			status = NPPNativeMethods.NPPi.AlphaComp.nppiAlphaComp_8s_AC1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nppAlphaOp);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAlphaComp_8s_AC1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #15
0
		/// <summary>
		/// Image copy.
		/// </summary>
		/// <param name="dst">Destination image</param>
		public void Copy(NPPImage_8sC2 dst)
		{
			status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_8s_C2R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_8s_C2R", status));
			NPPException.CheckNppStatus(status, this);
		}
 /// <summary>
 /// Two channel 8-bit signed convolution filter with border control.<para/>
 /// General purpose 2D convolution filter using floating-point weights with border control.<para/>
 /// Pixels under the mask are multiplied by the respective weights in the mask
 /// and the results are summed. Before writing the result pixel the sum is scaled
 /// back via division by nDivisor. If any portion of the mask overlaps the source
 /// image boundary the requested border type operation is applied to all mask pixels
 /// which fall outside of the source image. <para/>
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="pKernel">Pointer to the start address of the kernel coefficient array. Coeffcients are expected to be stored in reverse order</param>
 /// <param name="nKernelSize">Width and Height of the rectangular kernel.</param>
 /// <param name="oAnchor">X and Y offsets of the kernel origin frame of reference relative to the source pixel.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 /// <param name="nppStreamCtx">NPP stream context.</param>
 public void FilterBorder(NPPImage_8sC2 dest, CudaDeviceVariable <float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType, NppStreamContext nppStreamCtx)
 {
     status = NPPNativeMethods_Ctx.NPPi.FilterBorder32f.nppiFilterBorder32f_8s_C2R_Ctx(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, pKernel.DevicePointer, nKernelSize, oAnchor, eBorderType, nppStreamCtx);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBorder32f_8s_C2R_Ctx", status));
     NPPException.CheckNppStatus(status, this);
 }