Inheritance: NPPImageBase
Exemplo n.º 1
0
		/// <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(float alpha1, NPPImage_32fC1 src2, float alpha2, NPPImage_32fC1 dest, NppiAlphaOp nppAlphaOp)
		{
			status = NPPNativeMethods.NPPi.AlphaCompConst.nppiAlphaCompC_32f_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_32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 2
0
		/// <summary>
		/// 32-bit floating point complex to 32-bit floating point squared magnitude.
		/// <para/>
		/// Converts complex-number pixel image to single channel image computing
		/// the result pixels as the squared magnitude of the complex values.
		/// <para/>
		/// The squared magnitude is an itermediate result of magnitude computation and
		/// can thus be computed faster than actual magnitude. If magnitudes are required
		/// for sorting/comparing only, using this function instead of nppiMagnitude_32fc32f_C1R
		/// can be a worthwhile performance optimization.
		/// </summary>
		/// <param name="dest">Destination image</param>
		public void MagnitudeSqr(NPPImage_32fC1 dest)
		{
			status = NPPNativeMethods.NPPi.LinearTransforms.nppiMagnitudeSqr_32fc32f_C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMagnitudeSqr_32fc32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 3
0
		/// <summary>
		/// image remap. Not affecting Alpha.
		/// </summary>
		/// <param name="dst">Destination-Image</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 void RemapA(NPPImage_8uC4 dst, NPPImage_32fC1 pXMap, NPPImage_32fC1 pYMap, InterpolationMode eInterpolation)
		{
			NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
			status = NPPNativeMethods.NPPi.Remap.nppiRemap_8u_AC4R(_devPtr, _sizeRoi, _pitch, srcRect, pXMap.DevicePointerRoi, pXMap.Pitch, pYMap.DevicePointerRoi, pYMap.Pitch, dst.DevicePointerRoi, dst.Pitch, dst.SizeRoi, eInterpolation);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiRemap_8u_AC4R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 4
0
 /// <summary>
 /// image CrossCorrValid_Norm.
 /// </summary>
 /// <param name="tpl">template image.</param>
 /// <param name="dst">Destination-Image</param>
 public void CrossCorrValid_Norm(NPPImage_16uC1 tpl, NPPImage_32fC1 dst)
 {
     status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_Norm_16u32f_C1R(_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_16u32f_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 3 channel 8-bit unsigned packed RGB to optional 1 channel 16-bit signed X (vertical), Y (horizontal), magnitude, 
 /// and/or 32-bit floating point angle gradient vectors with user selectable fixed mask size and distance method with border control.
 /// </summary>
 /// <param name="destX">X vector destination_image_pointer</param>
 /// <param name="destY">Y vector destination_image_pointer.</param>
 /// <param name="destMag">magnitude destination_image_pointer.</param>
 /// <param name="destAngle">angle destination_image_pointer.</param>
 /// <param name="eMaskSize">fixed filter mask size to use.</param>
 /// <param name="eNorm">gradient distance method to use.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 public void GradientVectorSobelBorder(NPPImage_16sC1 destX, NPPImage_16sC1 destY, NPPImage_16sC1 destMag, NPPImage_32fC1 destAngle, MaskSize eMaskSize, NppiNorm eNorm, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.GradientVectorSobelBorder.nppiGradientVectorSobelBorder_8u16s_C3C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, destX.DevicePointerRoi, destX.Pitch, destY.DevicePointerRoi, destY.Pitch, destMag.DevicePointerRoi, destMag.Pitch, destAngle.DevicePointerRoi, destAngle.Pitch, _sizeRoi, eMaskSize, eNorm, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiGradientVectorSobelBorder_8u16s_C3C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// One 8-bit unsigned char channel image squared then added to in place floating point destination image.
 /// </summary>
 /// <param name="dest">Destination image</param>
 public void AddProduct(NPPImage_32fC1 dest)
 {
     status = NPPNativeMethods.NPPi.AddSquare.nppiAddSquare_16u32f_C1IR(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAddSquare_16u32f_C1IR", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Apply Row Window Summation filter over a 1D mask region around each source
 /// pixel for 1-channel 8-bit pixel input images with 32-bit floating point output.  
 /// Result 32-bit floating point pixel is equal to the sum of the corresponding and
 /// neighboring row pixel values in a mask region of the source image defined
 /// by nKernelDim and nAnchorX. 
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nMaskSize">Length of the linear kernel array.</param>
 /// <param name="nAnchor">X offset of the kernel origin frame of reference w.r.t the source pixel.</param>
 /// <param name="eBorderType">The border type operation to be applied at source image border boundaries.</param>
 public void SumWindowRowBorder(NPPImage_32fC1 dest, int nMaskSize, int nAnchor, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.WindowSum1D.nppiSumWindowRowBorder_16u32f_C1R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nMaskSize, nAnchor, eBorderType);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSumWindowRowBorder_16u32f_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 8
0
 /// <summary>
 /// planar image resize.
 /// </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="nXFactor">Factor by which x dimension is changed. </param>
 /// <param name="nYFactor">Factor by which y dimension is changed. </param>
 /// <param name="nXShift">Source pixel shift in x-direction.</param>
 /// <param name="nYShift">Source pixel shift in y-direction.</param>
 /// <param name="eInterpolation">The type of eInterpolation to perform resampling.</param>
 public static void ResizeSqrPixel(NPPImage_32fC1 src0, NPPImage_32fC1 src1, NPPImage_32fC1 src2, NPPImage_32fC1 dest0, NPPImage_32fC1 dest1, NPPImage_32fC1 dest2, double nXFactor, double nYFactor, double nXShift, double nYShift, InterpolationMode eInterpolation)
 {
     CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer };
     CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointer, dest1.DevicePointer, dest2.DevicePointer };
     NppiRect srcRect = new NppiRect(src0.PointRoi, src0.SizeRoi);
     NppiRect dstRect = new NppiRect(dest0.PointRoi, dest0.SizeRoi);
     NppStatus status = NPPNativeMethods.NPPi.ResizeSqrPixel.nppiResizeSqrPixel_32f_P3R(src, src0.SizeRoi, src0.Pitch, srcRect, dst, dest0.Pitch, dstRect, nXFactor, nYFactor, nXShift, nYShift, eInterpolation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiResizeSqrPixel_32f_P3R", status));
     NPPException.CheckNppStatus(status, null);
 }
Exemplo n.º 9
0
        /// <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="src0">Source image (Channel 0)</param>
        /// <param name="src1">Source image (Channel 1)</param>
        /// <param name="src2">Source image (Channel 2)</param>
        /// <param name="srcQuad">Source quadrangle [4,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="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 static void WarpPerspectiveQuad(NPPImage_32fC1 src0, NPPImage_32fC1 src1, NPPImage_32fC1 src2, double[,] srcQuad, NPPImage_32fC1 dest0, NPPImage_32fC1 dest1, NPPImage_32fC1 dest2, double[,] destQuad, InterpolationMode eInterpolation)
        {
            NppiRect rectIn = new NppiRect(src0.PointRoi, src0.SizeRoi);
            NppiRect rectOut = new NppiRect(dest0.PointRoi, dest0.SizeRoi);

            CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer };
            CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointer, dest1.DevicePointer, dest2.DevicePointer };

            NppStatus status = NPPNativeMethods.NPPi.PerspectiveTransforms.nppiWarpPerspectiveQuad_32f_P3R(src, src0.Size, src0.Pitch, rectIn, srcQuad, dst, dest0.Pitch, rectOut, destQuad, eInterpolation);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiWarpPerspectiveQuad_32f_P3R", status));
            NPPException.CheckNppStatus(status, null);
        }
Exemplo n.º 10
0
 /// <summary>
 /// 3 channel 32-bit floating point packed RGB to 1 channel 32-bit floating point packed Gray Gradient conversion.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="eNorm">Gradient distance method to use.</param>
 public void GradientColorToGray(NPPImage_32fC1 dest, NppiNorm eNorm)
 {
     NppStatus status = NPPNativeMethods.NPPi.GradientColorToGray.nppiGradientColorToGray_32f_C3C1R(DevicePointerRoi, Pitch, dest.DevicePointerRoi, dest.Pitch, SizeRoi, eNorm);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiGradientColorToGray_32f_C3C1R", status));
     NPPException.CheckNppStatus(status, null);
 }
Exemplo n.º 11
0
 /// <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_32fC1 src0, NPPImage_32fC1 src1, NPPImage_32fC1 src2, NPPImage_32fC1 dest0, NPPImage_32fC1 dest1, NPPImage_32fC1 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_32f_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_32f_P3R", status));
     NPPException.CheckNppStatus(status, null);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Three-channel 8-bit unsigned planar to packed image copy.
 /// </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="dest">Destination image</param>
 public static void Copy(NPPImage_32fC1 src0, NPPImage_32fC1 src1, NPPImage_32fC1 src2, NPPImage_32fC3 dest)
 {
     CUdeviceptr[] array = new CUdeviceptr[] { src0.DevicePointerRoi, src1.DevicePointerRoi, src2.DevicePointerRoi };
     NppStatus status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32f_P3C3R(array, src0.Pitch, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32f_P3C3R", status));
     NPPException.CheckNppStatus(status, null);
 }
Exemplo n.º 13
0
        /// <summary>
        /// 3 channel planar 8-bit unsigned inplace color twist.
        /// An input color twist matrix with floating-point pixel values is applied
        /// within ROI.
        /// </summary>
        /// <param name="srcDest0">Source / Destination image (Channel 0)</param>
        /// <param name="srcDest1">Source / Destinationimage (Channel 1)</param>
        /// <param name="srcDest2">Source / Destinationimage (Channel 2)</param>
        /// <param name="twistMatrix">The color twist matrix with floating-point pixel values [3,4].</param>
        public static void ColorTwist(NPPImage_32fC1 srcDest0, NPPImage_32fC1 srcDest1, NPPImage_32fC1 srcDest2, float[,] twistMatrix)
        {
            CUdeviceptr[] src = new CUdeviceptr[] { srcDest0.DevicePointerRoi, srcDest1.DevicePointerRoi, srcDest2.DevicePointerRoi };

            NppStatus status = NPPNativeMethods.NPPi.ColorTwist.nppiColorTwist_32f_IP3R(src, srcDest0.Pitch, srcDest0.SizeRoi, twistMatrix);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist32f_32f_IP3R", status));
            NPPException.CheckNppStatus(status, null);
        }
Exemplo n.º 14
0
		/// <summary>
		/// Affine transform of an image. <para/>This
		/// function performs affine warping of a the specified quadrangle in the
		/// source image to the specified quadrangle in the destination image. The
		/// function nppiWarpAffineQuad uses the same formulas for pixel mapping as in
		/// nppiWarpAffine function. The transform coefficients are computed internally.
		/// The transformed part of the source image is resampled using the specified
		/// eInterpolation 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="dstQuad">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 WarpAffineQuad(double[,] srcQuad, NPPImage_32fC1 dest, double[,] dstQuad, InterpolationMode eInterpolation)
		{
			NppiRect rectIn = new NppiRect(_pointRoi, _sizeRoi);
			NppiRect rectOut = new NppiRect(dest.PointRoi, dest.SizeRoi);
			status = NPPNativeMethods.NPPi.AffinTransforms.nppiWarpAffineQuad_32f_C1R(_devPtr, _sizeOriginal, _pitch, rectIn, srcQuad, dest.DevicePointer, dest.Pitch, rectOut, dstQuad, eInterpolation);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiWarpAffineQuad_32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 15
0
		/// <summary>
		/// One-channel 8-bit unsigned image SqrIntegral. 
		/// Destination integral image is 32-bit floating point.
		/// Destination square integral image is 64-bit double floating point.
		/// </summary>
		/// <param name="dst">Destination-Image</param>
		/// <param name="sqr">Destination-Image</param>
		/// <param name="nVal">The value to add to pDst image pixels</param>
		/// <param name="nValSqr">The value to add to pSqr image pixels</param>
		public void Integral(NPPImage_32fC1 dst, CudaPitchedDeviceVariable<double> sqr, float nVal, double nValSqr)
		{
			status = NPPNativeMethods.NPPi.Integral.nppiSqrIntegral_8u32f64f_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, sqr.DevicePointer, sqr.Pitch, _sizeRoi, nVal, nValSqr);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSqrIntegral_8u32f64f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 16
0
 /// <summary>
 /// Color to Gray conversion
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="aCoeffs">fixed size array of constant floating point conversion coefficient values, one per color channel.</param>
 public void ColorToGray(NPPImage_32fC1 dest, float[] aCoeffs)
 {
     status = NPPNativeMethods.NPPi.ColorToGray.nppiColorToGray_32f_C3C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, aCoeffs);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorToGray_32f_C3C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 17
0
		/// <summary>
		/// image conversion.
		/// </summary>
		/// <param name="dst">Destination-Image</param>
		/// <param name="nMin">specifies the minimum saturation value to which every output value will be clamped.</param>
		/// <param name="nMax">specifies the maximum saturation value to which every output value will be clamped.</param>
		public void Scale(NPPImage_32fC1 dst, float nMin, float nMax)
		{
			NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
			status = NPPNativeMethods.NPPi.Scale.nppiScale_8u32f_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nMin, nMax);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiScale_8u32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 18
0
 /// <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_32fC1 src2, NPPImage_8uC1 dest, NppCmpOp eComparisonOperation)
 {
     status = NPPNativeMethods.NPPi.Compare.nppiCompare_32f_C1R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, eComparisonOperation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCompare_32f_C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 19
0
 /// <summary>
 /// One 8-bit unsigned char channel alpha weighted image added to in place floating point destination image using filter mask (updates destination when mask is non-zero).
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="mask">Mask image</param>
 /// <param name="nAlpha">Alpha weight to be applied to source image pixels (0.0F to 1.0F)</param>
 public void AddWeighted(NPPImage_32fC1 dest, NPPImage_8uC1 mask, float nAlpha)
 {
     status = NPPNativeMethods.NPPi.AddWeighted.nppiAddWeighted_16u32f_C1IMR(_devPtrRoi, _pitch, mask.DevicePointerRoi, mask.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nAlpha);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAddWeighted_16u32f_C1IMR", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 20
0
 /// <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_32fC1 dst, int channel)
 {
     if (channel < 0 | channel >= _channels) throw new ArgumentOutOfRangeException("channel", "channel must be in range [0..2].");
     status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32f_C3C1R(_devPtrRoi + channel * _typeSize, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32f_C3C1R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 21
0
        /// <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_16uC1 tpl, NPPImage_32fC1 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_16u32f_C1R(_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_16u32f_C1R", status));
            NPPException.CheckNppStatus(status, this);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Three-channel 8-bit unsigned packed to planar image copy.
 /// </summary>
 /// <param name="dst0">Destination image channel 0</param>
 /// <param name="dst1">Destination image channel 1</param>
 /// <param name="dst2">Destination image channel 2</param>
 public void Copy(NPPImage_32fC1 dst0, NPPImage_32fC1 dst1, NPPImage_32fC1 dst2)
 {
     CUdeviceptr[] array = new CUdeviceptr[] { dst0.DevicePointerRoi, dst1.DevicePointerRoi, dst2.DevicePointerRoi };
     status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32f_C3P3R(_devPtrRoi, _pitch, array, dst0.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32f_C3P3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemplo n.º 23
0
        /// <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_16uC1 tpl, NPPImage_32fC1 dst)
        {
            int bufferSize = ValidNormLevelGetBufferHostSize();
            CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

            status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_NormLevel_16u32f_C1R(_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_16u32f_C1R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Exemplo n.º 24
0
		/// <summary>
		/// One 8-bit unsigned char channel image product added to in place floating point destination image using filter mask (updates destination when mask is non-zero).
		/// </summary>
		/// <param name="src2">2nd source image</param>
		/// <param name="dest">Destination image</param>
		/// <param name="mask">Mask image</param>
		public void AddProduct(NPPImage_8uC1 src2, NPPImage_32fC1 dest, NPPImage_8uC1 mask)
		{
			status = NPPNativeMethods.NPPi.AddProduct.nppiAddProduct_8u32f_C1IMR(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, mask.DevicePointerRoi, mask.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAddProduct_8u32f_C1IMR", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 25
0
		/// <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);
		}
Exemplo n.º 26
0
		/// <summary>
		/// 8-bit unsigned 1D (column) sum to 32f.
		/// Apply Column Window Summation filter over a 1D mask region around each
		/// source pixel for 1-channel 8 bit/pixel input images with 32-bit floating point
		/// output.  <para/>
		/// Result 32-bit floating point pixel is equal to the sum of the corresponding and
		/// neighboring column pixel values in a mask region of the source image defined by
		/// nMaskSize and nAnchor. 
		/// </summary>
		/// <param name="dest">Destination image</param>
		/// <param name="nMaskSize">Length of the linear kernel array.</param>
		/// <param name="nAnchor">Y offset of the kernel origin frame of reference w.r.t the source pixel.</param>
		public void SumWindowColumn(NPPImage_32fC1 dest, int nMaskSize, int nAnchor)
		{
			status = NPPNativeMethods.NPPi.WindowSum1D.nppiSumWindowColumn_8u32f_C1R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nMaskSize, nAnchor);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSumWindowColumn_8u32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 27
0
		/// <summary>
		/// Graphcut of a flow network (32bit floating point edge capacities). The
		/// function computes the minimal cut (graphcut) of a 2D regular 8-connected
		/// graph. <para/>
		/// The inputs are the capacities of the horizontal (in transposed form),
		/// vertical and terminal (source and sink) edges. The capacities to source and
		/// sink 
		/// are stored as capacity differences in the terminals array 
		/// ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
		/// edge capacities 
		/// for boundary edges that would connect to nodes outside the specified domain
		/// are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
		/// computed labeling may be wrong!<para/>
		/// The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
		/// </summary>
		/// <param name="Terminals">Pointer to differences of terminal edge capacities</param>
		/// <param name="LeftTransposed">Pointer to transposed left edge capacities</param>
		/// <param name="RightTransposed">Pointer to transposed right edge capacities</param>
		/// <param name="Top">Pointer to top edge capacities (top(*,0) must be 0)</param>
		/// <param name="TopLeft">Pointer to top left edge capacities (topleft(*,0) </param>
		/// <param name="TopRight">Pointer to top right edge capacities (topright(*,0)</param>
		/// <param name="Bottom">Pointer to bottom edge capacities (bottom(*,height-1)</param>
		/// <param name="BottomLeft">Pointer to bottom left edge capacities </param>
		/// <param name="BottomRight">Pointer to bottom right edge capacities </param>
		/// <param name="Label">Pointer to destination label image </param>
		/// <returns></returns>
		public void GraphCut(NPPImage_32fC1 Terminals, NPPImage_32fC1 LeftTransposed, NPPImage_32fC1 RightTransposed,
			NPPImage_32fC1 Top, NPPImage_32fC1 TopLeft, NPPImage_32fC1 TopRight, NPPImage_32fC1 Bottom, NPPImage_32fC1 BottomLeft,
			NPPImage_32fC1 BottomRight, NPPImage_8uC1 Label)
		{
			status = NPPNativeMethods.NPPi.ImageLabeling.nppiGraphcut8_32f8u(Terminals.DevicePointer, LeftTransposed.DevicePointer, 
				RightTransposed.DevicePointer, Top.DevicePointer, TopLeft.DevicePointer, TopRight.DevicePointer, Bottom.DevicePointer, 
				BottomLeft.DevicePointer, BottomRight.DevicePointer, Terminals.Pitch, LeftTransposed.Pitch, _size, Label.DevicePointer, 
				Label.Pitch, _state);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiGraphcut8_32f8u", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 28
0
		/// <summary>
		/// Integral with 32-bit floating point output.
		/// </summary>
		/// <param name="dst">Destination-Image</param>
		/// <param name="nVal">The value to add to pDst image pixels</param>
		public void Integral(NPPImage_32fC1 dst, float nVal)
		{
			status = NPPNativeMethods.NPPi.Integral.nppiIntegral_8u32f_C1R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nVal);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiIntegral_8u32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}
Exemplo n.º 29
0
		/// <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="src3">Source image (Channel 3)</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="dest3">Destination image (Channel 3)</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_8uC1 src0, NPPImage_8uC1 src1, NPPImage_8uC1 src2, NPPImage_8uC1 src3, NPPImage_8uC1 dest0, NPPImage_8uC1 dest1, NPPImage_8uC1 dest2, NPPImage_8uC1 dest3, NPPImage_32fC1 pXMap, NPPImage_32fC1 pYMap, InterpolationMode eInterpolation)
		{
			CUdeviceptr[] src = new CUdeviceptr[] { src0.DevicePointer, src1.DevicePointer, src2.DevicePointer, src3.DevicePointer };
			CUdeviceptr[] dst = new CUdeviceptr[] { dest0.DevicePointerRoi, dest1.DevicePointerRoi, dest2.DevicePointerRoi, dest3.DevicePointerRoi };
			NppiRect srcRect = new NppiRect(src0.PointRoi, src0.SizeRoi);
			NppStatus status = NPPNativeMethods.NPPi.Remap.nppiRemap_8u_P4R(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_8u_P4R", status));
			NPPException.CheckNppStatus(status, null);
		}
Exemplo n.º 30
0
		/// <summary>
		/// Divide constant to image.
		/// </summary>
		/// <param name="nConstant">Value</param>
		/// <param name="dest">Destination image</param>
		public void Div(float nConstant, NPPImage_32fC1 dest)
		{
			status = NPPNativeMethods.NPPi.DivConst.nppiDivC_32f_C1R(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiDivC_32f_C1R", status));
			NPPException.CheckNppStatus(status, this);
		}