Пример #1
0
        /// <summary>
        /// image NormDiff_L1. Buffer is internally allocated and freed.
        /// </summary>
        /// <param name="tpl">template image.</param>
        /// <param name="pNormDiff">Pointer to the computed L1-norm of differences. (3 * sizeof(double))</param>
        public void NormDiff_L1(NPPImage_32fC3 tpl, CudaDeviceVariable<double> pNormDiff)
        {
            int bufferSize = NormDiffL1GetBufferHostSize();
            CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

            status = NPPNativeMethods.NPPi.NormDiff.nppiNormDiff_L1_32f_C3R(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, _sizeRoi, pNormDiff.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormDiff_L1_32f_C3R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Пример #2
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_16uC3 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_16u32f_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_16u32f_C3R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #3
0
		/// <summary>
		/// image CrossCorrValid_Norm.
		/// </summary>
		/// <param name="tpl">template image.</param>
		/// <param name="dst">Destination-Image</param>
		public void CrossCorrValid_Norm(NPPImage_16uC3 tpl, NPPImage_32fC3 dst)
		{
			status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_Norm_16u32f_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_16u32f_C3R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #4
0
 /// <summary>
 /// Copy image and pad borders with a constant, user-specifiable color.
 /// </summary>
 /// <param name="dst">Destination image. The image ROI defines the destination region, i.e. the region that gets filled with data from
 /// the source image (inner part) and constant border color (outer part).</param>
 /// <param name="nTopBorderHeight">Height (in pixels) of the top border. The height of the border at the bottom of
 /// the destination ROI is implicitly defined by the size of the source ROI: nBottomBorderHeight =
 /// oDstSizeROI.height - nTopBorderHeight - oSrcSizeROI.height.</param>
 /// <param name="nLeftBorderWidth">Width (in pixels) of the left border. The width of the border at the right side of
 /// the destination ROI is implicitly defined by the size of the source ROI: nRightBorderWidth =
 /// oDstSizeROI.width - nLeftBorderWidth - oSrcSizeROI.width.</param>
 /// <param name="nValue">The pixel value to be set for border pixels.</param>
 public void Copy(NPPImage_32fC3 dst, int nTopBorderHeight, int nLeftBorderWidth, float[] nValue)
 {
     status = NPPNativeMethods.NPPi.CopyConstBorder.nppiCopyConstBorder_32f_C3R(_devPtrRoi, _pitch, _sizeRoi, dst.DevicePointerRoi, dst.Pitch, dst.SizeRoi, nTopBorderHeight, nLeftBorderWidth, nValue);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopyConstBorder_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #5
0
		//New in Cuda 6.0

		#region SumWindow
		/// <summary>
		/// 16-bit signed 1D (column) sum to 32f.
		/// Apply Column Window Summation filter over a 1D mask region around each
		/// source pixel for 3-channel 16 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_32fC3 dest, int nMaskSize, int nAnchor)
		{
			status = NPPNativeMethods.NPPi.WindowSum1D.nppiSumWindowColumn_16s32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nMaskSize, nAnchor);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSumWindowColumn_16s32f_C3R", 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_32fC3 dest, float[,] twistMatrix)
 {
     status = NPPNativeMethods.NPPi.ColorTwist.nppiColorTwist_32f_C3R(_devPtr, _pitch, dest.DevicePointer, dest.Pitch, _sizeRoi, twistMatrix);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiColorTwist_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #7
0
 /// <summary>
 /// Image copy.
 /// </summary>
 /// <param name="dst">Destination image</param>
 /// <param name="channelSrc">Channel number. This number is added to the src pointer</param>
 /// <param name="channelDst">Channel number. This number is added to the dst pointer</param>
 public void Copy(NPPImage_32fC3 dst, int channelSrc, int channelDst)
 {
     if (channelSrc < 0 | channelSrc >= _channels) throw new ArgumentOutOfRangeException("channelSrc", "channelSrc must be in range [0..2].");
     if (channelDst < 0 | channelDst >= dst.Channels) throw new ArgumentOutOfRangeException("channelDst", "channelDst must be in range [0..2].");
     status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32f_C3CR(_devPtrRoi + channelSrc * _typeSize, _pitch, dst.DevicePointerRoi + channelDst * _typeSize, dst.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32f_C3CR", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #8
0
 /// <summary>
 /// image resize.
 /// </summary>
 /// <param name="dst">Destination-Image</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 void ResizeSqrPixel(NPPImage_32fC3 dst, double nXFactor, double nYFactor, double nXShift, double nYShift, InterpolationMode eInterpolation)
 {
     NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
     NppiRect dstRect = new NppiRect(dst.PointRoi, dst.SizeRoi);
     status = NPPNativeMethods.NPPi.ResizeSqrPixel.nppiResizeSqrPixel_32f_C3R(_devPtr, _sizeRoi, _pitch, srcRect, dst.DevicePointer, dst.Pitch, dstRect, nXFactor, nYFactor, nXShift, nYShift, eInterpolation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiResizeSqrPixel_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #9
0
 /// <summary>
 /// Rotate images.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nAngle">The angle of rotation in degrees.</param>
 /// <param name="nShiftX">Shift along horizontal axis</param>
 /// <param name="nShiftY">Shift along vertical axis</param>
 /// <param name="eInterpolation">Interpolation mode</param>
 public void Rotate(NPPImage_32fC3 dest, double nAngle, double nShiftX, double nShiftY, InterpolationMode eInterpolation)
 {
     status = NPPNativeMethods.NPPi.GeometricTransforms.nppiRotate_32f_C3R(_devPtr, _sizeRoi, _pitch, new NppiRect(_pointRoi, _sizeRoi),
         dest.DevicePointer, dest.Pitch, new NppiRect(dest.PointRoi, dest.SizeRoi), nAngle, nShiftX, nShiftY, eInterpolation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiRotate_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #10
0
 /// <summary>
 /// image remap.
 /// </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 Remap(NPPImage_32fC3 dst, NPPImage_32fC1 pXMap, NPPImage_32fC1 pYMap, InterpolationMode eInterpolation)
 {
     NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
     status = NPPNativeMethods.NPPi.Remap.nppiRemap_32f_C3R(_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_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #11
0
 /// <summary>
 /// Resizes images.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="xFactor">X scaling factor</param>
 /// <param name="yFactor">Y scaling factor</param>
 /// <param name="eInterpolation">Interpolation mode</param>
 public void Resize(NPPImage_32fC3 dest, double xFactor, double yFactor, InterpolationMode eInterpolation)
 {
     status = NPPNativeMethods.NPPi.GeometricTransforms.nppiResize_32f_C3R(_devPtr, _sizeOriginal, _pitch, new NppiRect(_pointRoi, _sizeRoi), dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, xFactor, yFactor, eInterpolation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiResize_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #12
0
        /// <summary>
        /// image QualityIndex.
        /// </summary>
        /// <param name="src2">2nd source image</param>
        /// <param name="dst">Pointer to the quality index. (3 * sizeof(float))</param>
        public void QualityIndex(NPPImage_32fC3 src2, CudaDeviceVariable<float> dst)
        {
            int bufferSize = QualityIndexGetBufferHostSize();
            CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

            status = NPPNativeMethods.NPPi.QualityIndex.nppiQualityIndex_32f_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, dst.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiQualityIndex_32f_C3R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Пример #13
0
        /// <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_32fC3 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_32f_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_32f_C3CMR", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
Пример #14
0
        /// <summary>
        /// image NormRel_L2.
        /// </summary>
        /// <param name="tpl">template image.</param>
        /// <param name="pNormRel">Pointer to the computed relative error for the infinity norm of two images. (3 * sizeof(double))</param>
        /// <param name="buffer">Allocated device memory with size of at <see cref="NormRelL2GetBufferHostSize()"/></param>
        public void NormRel_L2(NPPImage_32fC3 tpl, CudaDeviceVariable<double> pNormRel, CudaDeviceVariable<byte> buffer)
        {
            int bufferSize = NormRelL2GetBufferHostSize();
            if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small.");

            status = NPPNativeMethods.NPPi.NormRel.nppiNormRel_L2_32f_C3R(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, _sizeRoi, pNormRel.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormRel_L2_32f_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
Пример #15
0
 /// <summary>
 /// Add constant to image.
 /// </summary>
 /// <param name="nConstant">Values to add</param>
 /// <param name="dest">Destination image</param>
 public void Add(float[] nConstant, NPPImage_32fC3 dest)
 {
     status = NPPNativeMethods.NPPi.AddConst.nppiAddC_32f_C3R(_devPtrRoi, _pitch, nConstant, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAddC_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #16
0
 /// <summary>
 /// horizontal Sobel filter.
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 public void SobelHoriz(NPPImage_32fC3 dst)
 {
     status = NPPNativeMethods.NPPi.FixedFilters.nppiFilterSobelHoriz_32f_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterSobelHoriz_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #17
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_32fC3 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_32f_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAverageRelativeError_32f_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
Пример #18
0
 /// <summary>
 /// Swap color channels
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="aDstOrder">Integer array describing how channel values are permutated. <para/>The n-th entry of the array
 /// contains the number of the channel that is stored in the n-th channel of the output image. <para/>E.g.
 /// Given an RGB image, aDstOrder = [2,1,0] converts this to BGR channel order.</param>
 public void SwapChannels(NPPImage_32fC3 dest, int[] aDstOrder)
 {
     status = NPPNativeMethods.NPPi.SwapChannel.nppiSwapChannels_32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, aDstOrder);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSwapChannels_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #19
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="epsilon">epsilon tolerance value to compare to pixel absolute differences.</param>
 public void CompareEqualEps(NPPImage_32fC3 src2, NPPImage_8uC1 dest, float epsilon)
 {
     status = NPPNativeMethods.NPPi.Compare.nppiCompareEqualEps_32f_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, epsilon);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCompareEqualEps_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #20
0
 /// <summary>
 /// Image threshold.<para/>
 /// If for a comparison operations OP the predicate (sourcePixel OP nThreshold) is true, the pixel is set
 /// to nValue, otherwise it is set to sourcePixel.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nThreshold">The threshold value.</param>
 /// <param name="nValue">The threshold replacement value.</param>
 /// <param name="eComparisonOperation">eComparisonOperation. Only allowed values are <see cref="NppCmpOp.Less"/> and <see cref="NppCmpOp.Greater"/></param>
 public void Threshold(NPPImage_32fC3 dest, float[] nThreshold, float[] nValue, NppCmpOp eComparisonOperation)
 {
     status = NPPNativeMethods.NPPi.Threshold.nppiThreshold_Val_32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nThreshold, nValue, eComparisonOperation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiThreshold_Val_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #21
0
 /// <summary>
 /// Masked Operation 8-bit unsigned image copy.
 /// </summary>
 /// <param name="dst">Destination image</param>
 /// <param name="mask">Mask image</param>
 public void Copy(NPPImage_32fC3 dst, NPPImage_8uC1 mask)
 {
     status = NPPNativeMethods.NPPi.MemCopy.nppiCopy_32f_C3MR(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, mask.DevicePointerRoi, mask.Pitch);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiCopy_32f_C3MR", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #22
0
 /// <summary>
 /// Image threshold.<para/>
 /// If for a comparison operations sourcePixel is less than nThresholdLT is true, the pixel is set
 /// to nValueLT, else if sourcePixel is greater than nThresholdGT the pixel is set to nValueGT, otherwise it is set to sourcePixel.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nThresholdLT">The thresholdLT value.</param>
 /// <param name="nValueLT">The thresholdLT replacement value.</param>
 /// <param name="nThresholdGT">The thresholdGT value.</param>
 /// <param name="nValueGT">The thresholdGT replacement value.</param>
 public void ThresholdLTGT(NPPImage_32fC3 dest, float[] nThresholdLT, float[] nValueLT, float[] nThresholdGT, float[] nValueGT)
 {
     status = NPPNativeMethods.NPPi.Threshold.nppiThreshold_LTValGTVal_32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nThresholdLT, nValueLT, nThresholdGT, nValueGT);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiThreshold_LTValGTVal_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #23
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_32fC3 dst, float nMin, float nMax)
 {
     NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
     status = NPPNativeMethods.NPPi.Scale.nppiScale_8u32f_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nMin, nMax);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiScale_8u32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #24
0
 /// <summary>
 /// image transpose
 /// </summary>
 /// <param name="dest">Destination image</param>
 public void Transpose(NPPImage_32fC3 dest)
 {
     status = NPPNativeMethods.NPPi.Transpose.nppiTranspose_32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiTranspose_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #25
0
		/// <summary>
		/// 16-bit unsigned to 32-bit floating point conversion.
		/// </summary>
		/// <param name="dst">Destination image</param>
		public void Convert(NPPImage_32fC3 dst)
		{
			status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_16u32f_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_16u32f_C3R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #26
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="srcQuad">Source quadrangle [4,2]</param>
 /// <param name="dest">Destination image</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 void WarpPerspectiveQuad(double[,] srcQuad, NPPImage_32fC3 dest, double[,] destQuad, InterpolationMode eInterpolation)
 {
     NppiRect rectIn = new NppiRect(_pointRoi, _sizeRoi);
     NppiRect rectOut = new NppiRect(dest.PointRoi, dest.SizeRoi);
     status = NPPNativeMethods.NPPi.PerspectiveTransforms.nppiWarpPerspectiveQuad_32f_C3R(_devPtr, _sizeOriginal, _pitch, rectIn, srcQuad, dest.DevicePointer, dest.Pitch, rectOut, destQuad, eInterpolation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiWarpPerspectiveQuad_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #27
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_16uC3 tpl, NPPImage_32fC3 dst)
		{
			int bufferSize = ValidNormLevelGetBufferHostSize();
			CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

			status = NPPNativeMethods.NPPi.ImageProximity.nppiCrossCorrValid_NormLevel_16u32f_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_16u32f_C3R", status));
			buffer.Dispose();
			NPPException.CheckNppStatus(status, this);
		}
Пример #28
0
 /// <summary>
 /// In place image addition.
 /// </summary>
 /// <param name="src2">2nd source image</param>
 public void Add(NPPImage_32fC3 src2)
 {
     status = NPPNativeMethods.NPPi.Add.nppiAdd_32f_C3IR(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiAdd_32f_C3IR", status));
     NPPException.CheckNppStatus(status, this);
 }
Пример #29
0
		/// <summary>
		/// Apply Row Window Summation filter over a 1D mask region around each source
		/// pixel for 3-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_32fC3 dest, int nMaskSize, int nAnchor, NppiBorderType eBorderType)
		{
			status = NPPNativeMethods.NPPi.WindowSum1D.nppiSumWindowRowBorder_16u32f_C3R(_devPtr, _pitch, _sizeOriginal, _pointRoi, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nMaskSize, nAnchor, eBorderType);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSumWindowRowBorder_16u32f_C3R", status));
			NPPException.CheckNppStatus(status, this);
		}
Пример #30
0
 /// <summary>
 /// Mirror image.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="flip">Specifies the axis about which the image is to be mirrored.</param>
 public void Mirror(NPPImage_32fC3 dest, NppiAxis flip)
 {
     status = NPPNativeMethods.NPPi.GeometricTransforms.nppiMirror_32f_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, flip);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMirror_32f_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }