/*
         *
         * const float3* __restrict__ rawImgRef,
         * const float3* __restrict__ rawImgMoved,
         * float3* __restrict__ robustnessMask,
         * cudaTextureObject_t texUV,
         * int imgWidth,
         * int imgHeight,
         * int imgPitch,
         * float alpha,
         * float beta)
         */
        public float RunSafe(NPPImage_32fC3 rawImgRef, NPPImage_32fC3 rawImgMoved, NPPImage_32fC4 robustnessMask, NPPImage_32fC2 shift, float alpha, float beta, float thresholdM)
        {
            this.BlockDimensions = new dim3(8, 8, 1);
            this.SetComputeSize((uint)(rawImgRef.WidthRoi), (uint)(rawImgRef.HeightRoi), 1);
            this.DynamicSharedMemory = BlockDimensions.x * BlockDimensions.y * float3.SizeOf * 3 * 3;

            CudaResourceDesc      descShift    = new CudaResourceDesc(shift);
            CudaTextureDescriptor texDescShift = new CudaTextureDescriptor(CUAddressMode.Mirror, CUFilterMode.Linear, CUTexRefSetFlags.NormalizedCoordinates);
            CudaTexObject         texShift     = new CudaTexObject(descShift, texDescShift);


            float t = this.Run(rawImgRef.DevicePointerRoi, rawImgMoved.DevicePointerRoi, robustnessMask.DevicePointerRoi, texShift.TexObject, rawImgRef.WidthRoi,
                               rawImgRef.HeightRoi, rawImgRef.Pitch, robustnessMask.Pitch, alpha, beta, thresholdM);

            texShift.Dispose();

            return(t);
        }
Esempio n. 2
0
 /// <summary>
 /// 16-bit floating point to 32-bit conversion. Not affecting Alpha.
 /// </summary>
 /// <param name="dst">Destination image</param>
 public void ConvertA(NPPImage_32fC4 dst)
 {
     status = NPPNativeMethods.NPPi.BitDepthConversion.nppiConvert_16f32f_AC4R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiConvert_16f32f_AC4R", status));
     NPPException.CheckNppStatus(status, this);
 }
        public float RunSafe(CudaDeviceVariable <ushort> dataIn, NPPImage_32fC3 imgOut, NPPImage_32fC3 totalWeights, NPPImage_32fC4 certaintyMask, NPPImage_32fC4 kernelParam, NPPImage_32fC2 shifts, float3 whiteLevel, float3 blackLevel)
        {
            SetComputeSize((uint)imgOut.WidthRoi, (uint)imgOut.HeightRoi);

            CudaResourceDesc      descKernel    = new CudaResourceDesc(kernelParam);
            CudaTextureDescriptor texDescKernel = new CudaTextureDescriptor(CUAddressMode.Clamp, CUFilterMode.Linear, CUTexRefSetFlags.NormalizedCoordinates);
            CudaTexObject         texKernel     = new CudaTexObject(descKernel, texDescKernel);

            CudaResourceDesc      descShift    = new CudaResourceDesc(shifts);
            CudaTextureDescriptor texDescShift = new CudaTextureDescriptor(CUAddressMode.Mirror, CUFilterMode.Linear, CUTexRefSetFlags.NormalizedCoordinates);
            CudaTexObject         texShift     = new CudaTexObject(descShift, texDescShift);

            float t = base.Run(dataIn.DevicePointer, imgOut.DevicePointerRoi, totalWeights.DevicePointerRoi,
                               certaintyMask.DevicePointerRoi, texKernel.TexObject, texShift.TexObject,
                               whiteLevel, blackLevel, imgOut.WidthRoi, imgOut.HeightRoi, imgOut.Pitch, certaintyMask.Pitch, kernelParam.Pitch, shifts.Pitch);

            texShift.Dispose();
            texKernel.Dispose();
            return(t);
        }
        public float RunSafe(CudaDeviceVariable <ushort> dataIn, NPPImage_32fC3 imgOut, NPPImage_32fC3 totalWeights, NPPImage_32fC4 certaintyMask, NPPImage_32fC3 kernelParam, NPPImage_32fC2 shifts, float3 whiteLevel, float3 blackLevel)
        {
            SetComputeSize((uint)imgOut.WidthRoi, (uint)imgOut.HeightRoi);

            return(base.Run(dataIn.DevicePointer, imgOut.DevicePointerRoi, totalWeights.DevicePointerRoi,
                            certaintyMask.DevicePointerRoi, kernelParam.DevicePointerRoi, shifts.DevicePointerRoi,
                            whiteLevel, blackLevel, imgOut.WidthRoi, imgOut.HeightRoi, imgOut.Pitch, certaintyMask.Pitch, shifts.Pitch));
        }