ManagedCuda.NPP.NPPImage_8uC3.FilterUnsharpBorder C# (CSharp) Method

FilterUnsharpBorder() public method

Filters the image using a unsharp-mask sharpening filter kernel with border control. The algorithm involves the following steps: Smooth the original image with a Gaussian filter, with the width controlled by the nRadius. Subtract the smoothed image from the original to create a high-pass filtered image. Apply any clipping needed on the high-pass image, as controlled by the nThreshold. Add a certain percentage of the high-pass filtered image to the original image, with the percentage controlled by the nWeight. In pseudocode this algorithm can be written as: HighPass = Image - Gaussian(Image) Result = Image + nWeight * HighPass * ( |HighPass| >= nThreshold ) where nWeight is the amount, nThreshold is the threshold, and >= indicates a Boolean operation, 1 if true, or 0 otherwise. 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.
public FilterUnsharpBorder ( NPPImage_8uC3 dst, float nRadius, float nSigma, float nWeight, float nThreshold, NppiBorderType eBorderType, CudaDeviceVariable buffer ) : void
dst NPPImage_8uC3 Destination-Image
nRadius float The radius of the Gaussian filter, in pixles, not counting the center pixel.
nSigma float The standard deviation of the Gaussian filter, in pixel.
nWeight float The percentage of the difference between the original and the high pass image that is added back into the original.
nThreshold float The threshold needed to apply the difference amount.
eBorderType NppiBorderType The border type operation to be applied at source image border boundaries.
buffer CudaDeviceVariable Pointer to the user-allocated device scratch buffer required for the unsharp operation.
return void
        public void FilterUnsharpBorder(NPPImage_8uC3 dst, float nRadius, float nSigma, float nWeight, float nThreshold, NppiBorderType eBorderType, CudaDeviceVariable<byte> buffer)
        {
            if (buffer.Size < FilterUnsharpGetBufferSize(nRadius, nSigma))
                throw new NPPException("Provided buffer is too small.");

            status = NPPNativeMethods.NPPi.FixedFilters.nppiFilterUnsharpBorder_8u_C3R(_devPtr, _pitch, _pointRoi, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, nRadius, nSigma, nWeight, nThreshold, eBorderType, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterUnsharpBorder_8u_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
NPPImage_8uC3