Library/ManagedCuda/NPP/NPPImage_8uC3.cs
/// <summary>
/// Affine transform of an image. <para/>This
/// function operates using given transform coefficients that can be obtained
/// by using nppiGetAffineTransform function or set explicitly. The function
/// operates on source and destination regions of interest. The affine warp
/// function transforms the source image pixel coordinates (x,y) according
/// to the following formulas:<para/>
/// X_new = C_00 * x + C_01 * y + C_02<para/>
/// Y_new = C_10 * x + C_11 * y + C_12<para/>
/// The transformed part of the source image is resampled using the specified
/// interpolation method and written to the destination ROI.
/// The functions nppiGetAffineQuad and nppiGetAffineBound can help with 
/// destination ROI specification.<para/>
/// <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 does not 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.<para/>
/// 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="dest0">Destination image (Channel 0)</param>
/// <param name="dest1">Destination image (Channel 1)</param>
/// <param name="dest2">Destination image (Channel 2)</param>
/// <param name="coeffs">Affine transform coefficients [2,3]</param>
/// <param name="eInterpolation">Interpolation mode: can be <see cref="InterpolationMode.NearestNeighbor"/>, <see cref="InterpolationMode.Linear"/> or <see cref="InterpolationMode.Cubic"/></param>
Affine transform of an image. This
function operates using given transform coefficients that can be obtained
by using nppiGetAffineTransform function or set explicitly. The function
operates on source and destination regions of interest. The affine warp
function transforms the source image pixel coordinates (x,y) according
to the following formulas:
X_new = C_00 * x + C_01 * y + C_02
Y_new = C_10 * x + C_11 * y + C_12
The transformed part of the source image is resampled using the specified
interpolation method and written to the destination ROI.
The functions nppiGetAffineQuad and nppiGetAffineBound can help with
destination ROI specification.
NPPI specific recommendation:
The function operates using 2 types of kernels: fast and accurate. The fast
method is about 4 times faster than its accurate variant,
but does not 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.
Affine transform of an image . This function operates using given transform coefficients that can be obtained by using nppiGetAffineTransform function or set explicitly . The function operates on source and destination regions of interest . The affine warp function transforms the source image pixel coordinates ( x y ) according to the following formulas : X_new = C_00 * x + C_01 * y + C_02 Y_new = C_10 * x + C_11 * y + C_12 The transformed part of the source image is resampled using the specified interpolation method and written to the destination ROI . The functions nppiGetAffineQuad and nppiGetAffineBound can help with destination ROI specification . NPPI specific recommendation : The function operates using 2 types of kernels : fast and accurate . The fast method is about 4 times faster than its accurate variant but does not 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 .
public static void WarpAffine(NPPImage_8uC1 src0, NPPImage_8uC1 src1, NPPImage_8uC1 src2, NPPImage_8uC1 dest0, NPPImage_8uC1 dest1, NPPImage_8uC1 dest2, double[,] coeffs, 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.AffinTransforms.nppiWarpAffine_8u_P3R(src, src0.Size, src0.Pitch, rectIn, dst, dest0.Pitch, rectOut, coeffs, eInterpolation);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiWarpAffine_8u_P3R", status));
			NPPException.CheckNppStatus(status, null);
		}
public static void WarpAffine ( NPPImage_8uC1 src0 , NPPImage_8uC1 src1 , NPPImage_8uC1 src2 , NPPImage_8uC1 dest0 , NPPImage_8uC1 dest1 , NPPImage_8uC1 dest2 , double [ , ] coeffs , 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 . AffinTransforms . nppiWarpAffine_8u_P3R ( src , src0 . Size , src0 . Pitch , rectIn , dst , dest0 . Pitch , rectOut , coeffs , eInterpolation ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , status ) ) ; NPPException . CheckNppStatus ( status , null ) ; }
Affine transform of an image.
Affine transform of an image .
src0
NPPImage_8uC1
Source image (Channel 0)
Source image ( Channel 0 )
src1
NPPImage_8uC1
Source image (Channel 1)
Source image ( Channel 1 )
src2
NPPImage_8uC1
Source image (Channel 2)
Source image ( Channel 2 )
dest0
NPPImage_8uC1
Destination image (Channel 0)
Destination image ( Channel 0 )
dest1
NPPImage_8uC1
Destination image (Channel 1)
Destination image ( Channel 1 )
dest2
NPPImage_8uC1
Destination image (Channel 2)
Destination image ( Channel 2 )
coeffs
double[,]
Affine transform coefficients [2,3]
Affine transform coefficients [ 2 3 ]
eInterpolation
InterpolationMode
Interpolation mode: can be ,  or
Interpolation mode : can be or