/// <summary>
        /// in place flood fill.
        /// </summary>
        /// <param name="oSeed">Image location of seed pixel value to be used for comparison.</param>
        /// <param name="nMin">Value of each element of tested pixel must be &gt;= the corresponding seed value - aMin value.</param>
        /// <param name="nMax">Valeu of each element of tested pixel must be &lt;= the corresponding seed value + aMax value.</param>
        /// <param name="nNewValue">Image pixel values to be used to replace matching pixels.</param>
        /// <param name="nBoundaryValue">Image pixel values to be used for region boundary. </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 NppiConnectedRegion FloodFillGradient(NppiPoint oSeed, uint nMin, uint nMax, uint nNewValue, uint nBoundaryValue, NppiNorm eNorm, CudaDeviceVariable <byte> pBuffer)
        {
            NppiConnectedRegion pConnectedRegion = new NppiConnectedRegion();

            status = NPPNativeMethods.NPPi.FloodFill.nppiFloodFillGradientBoundary_32u_C1IR(_devPtrRoi, _pitch, oSeed, nMin, nMax, nNewValue, nBoundaryValue, eNorm, _sizeRoi, ref pConnectedRegion, pBuffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFloodFillGradientBoundary_32u_C1IR", status));
            NPPException.CheckNppStatus(status, this);
            return(pConnectedRegion);
        }
Exemple #2
0
        /// <summary>
        /// in place flood fill.
        /// </summary>
        /// <param name="oSeed">Image location of seed pixel value to be used for comparison.</param>
        /// <param name="nNewValue">Image pixel values to be used to replace matching pixels.</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>
        /// <param name="nppStreamCtx">NPP stream context.</param>
        public NppiConnectedRegion FloodFill(NppiPoint oSeed, uint nNewValue, NppiNorm eNorm, CudaDeviceVariable <byte> pBuffer, NppStreamContext nppStreamCtx)
        {
            NppiConnectedRegion pConnectedRegion = new NppiConnectedRegion();

            status = NPPNativeMethods_Ctx.NPPi.FloodFill.nppiFloodFill_32u_C1IR_Ctx(_devPtrRoi, _pitch, oSeed, nNewValue, eNorm, _sizeRoi, ref pConnectedRegion, pBuffer.DevicePointer, nppStreamCtx);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFloodFill_32u_C1IR_Ctx", status));
            NPPException.CheckNppStatus(status, this);
            return(pConnectedRegion);
        }
        public void LucasKanade(NPPImage_32fC1 sourceImg, NPPImage_32fC1 targetImg, NPPImage_32fC2 tiledFlow, int tileSize, int tileCountX, int tileCountY, int iterations, float2 baseShift, float baseRotation, float minDet, int windowSize)
        {
            createFlowFieldFromTiles.RunSafe(tiledFlow, d_flow, baseShift, baseRotation, tileSize, tileCountX, tileCountY);

            for (int iter = 0; iter < iterations; iter++)
            {
                warpingKernel.RunSafe(sourceImg, d_tmp, d_flow);
                NppiPoint p = new NppiPoint(0, 0);
                d_Ix.Set(0);
                d_Iy.Set(0);
                d_Iz.Set(0);

                computeDerivativesKernel.RunSafe(d_tmp, targetImg, d_Ix, d_Iy, d_Iz);
                lukasKanade.RunSafe(d_flow, d_Ix, d_Iy, d_Iz, minDet, windowSize);
            }
            warpingKernel.RunSafe(sourceImg, d_tmp, d_flow);
            d_tmp.Copy(sourceImg);
        }
Exemple #4
0
 /// <summary>
 /// 32-bit float convolution filter with border control.
 /// </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>
 /// <param name="nppStreamCtx">NPP stream context.</param>
 public void FilterBorder(NPPImage_16fC1 dest, CudaDeviceVariable <float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType, NppStreamContext nppStreamCtx, NppiRect filterArea = new NppiRect())
 {
     if (filterArea.Size == new NppiSize())
     {
         filterArea.Size = _sizeRoi;
     }
     status = NPPNativeMethods_Ctx.NPPi.FilterBorder32f.nppiFilterBorder32f_16f_C1R_Ctx(_devPtrRoi, _pitch, filterArea.Size, filterArea.Location, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, pKernel.DevicePointer, nKernelSize, oAnchor, eBorderType, nppStreamCtx);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilterBorder32f_16f_C1R_Ctx", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemple #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>
 /// <param name="nppStreamCtx">NPP stream context.</param>
 public void Filter(NPPImage_16fC1 dst, CudaDeviceVariable <float> pKernel, NppiSize oKernelSize, NppiPoint oAnchor, NppStreamContext nppStreamCtx)
 {
     status = NPPNativeMethods_Ctx.NPPi.Convolution.nppiFilter32f_16f_C1R_Ctx(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, pKernel.DevicePointer, oKernelSize, oAnchor, nppStreamCtx);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiFilter32f_16f_C1R_Ctx", status));
     NPPException.CheckNppStatus(status, this);
 }
Exemple #6
0
 /// <summary>
 /// Two channel 32-bit float 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_32fC2 dest, CudaDeviceVariable <float> pKernel, NppiSize nKernelSize, NppiPoint oAnchor, NppiBorderType eBorderType)
 {
     status = NPPNativeMethods.NPPi.FilterBorder.nppiFilterBorder_32f_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, "nppiFilterBorder_32f_C2R", status));
     NPPException.CheckNppStatus(status, this);
 }