当前位置: 首页>>代码示例>>C#>>正文


C# NPP.NPPImage_8uC3类代码示例

本文整理汇总了C#中ManagedCuda.NPP.NPPImage_8uC3的典型用法代码示例。如果您正苦于以下问题:C# NPPImage_8uC3类的具体用法?C# NPPImage_8uC3怎么用?C# NPPImage_8uC3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NPPImage_8uC3类属于ManagedCuda.NPP命名空间,在下文中一共展示了NPPImage_8uC3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Ln

 /// <summary>
 /// Natural logarithm, scale by 2^(-nScaleFactor), then clamp to saturated value.
 /// </summary>
 /// <param name="dest">Destination image</param>
 /// <param name="nScaleFactor">scaling factor</param>
 public void Ln(NPPImage_8uC3 dest, int nScaleFactor)
 {
     status = NPPNativeMethods.NPPi.Ln.nppiLn_8u_C3RSfs(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nScaleFactor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLn_8u_C3RSfs", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:11,代码来源:NPPImage_8uC3.cs

示例2: btn_Resize_Click

        private void btn_Resize_Click(object sender, EventArgs e)
        {
            if ((Bitmap)pic_Image.Image == null) return;

            Bitmap bmp = (Bitmap)pic_Image.Image;
            int w = bmp.Width;
            int h = bmp.Height;

            if ((w <= 16 || h <= 16) && trk_Size.Value < 100)
            {
                MessageBox.Show("Image is too small for resizing.");
                return;
            }

            int newW = (int)(trk_Size.Value / 100.0f * w);
            int newH = (int)(trk_Size.Value / 100.0f * h);

            if (newW % 16 != 0)
            {
                newW = newW - (newW % 16);
            }
            if (newW < 16) newW = 16;

            if (newH % 16 != 0)
            {
                newH = newH - (newH % 16);
            }
            if (newH < 16) newH = 16;

            double ratioW = newW / (double)w;
            double ratioH = newH / (double)h;

            if (ratioW == 1 && ratioH == 1)
                return;

            if (bmp.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb)
            {
                MessageBox.Show("Only three channel color images are supported!");
                return;
            }

            NPPImage_8uC3 imgIn = new NPPImage_8uC3(w, h);
            NPPImage_8uC3 imgOut = new NPPImage_8uC3(newW, newH);

            InterpolationMode interpol = InterpolationMode.SuperSampling;
            if (ratioH >= 1 || ratioW >= 1)
                interpol = InterpolationMode.Lanczos;

            imgIn.CopyToDevice(bmp);
            imgIn.ResizeSqrPixel(imgOut, ratioW, ratioH, 0, 0, interpol);
            Bitmap bmpRes = new Bitmap(newW, newH, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            imgOut.CopyToHost(bmpRes);
            pic_Image.Image = bmpRes;

            imgIn.Dispose();
            imgOut.Dispose();
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:57,代码来源:Form1.cs

示例3: Scale

		/// <summary>
		/// image conversion.
		/// </summary>
		/// <param name="dst">Destination-Image</param>
		/// <param name="hint">algorithm performance or accuracy selector, currently ignored</param>
		public void Scale(NPPImage_8uC3 dst, NppHintAlgorithm hint)
		{
			NppiRect srcRect = new NppiRect(_pointRoi, _sizeRoi);
			status = NPPNativeMethods.NPPi.Scale.nppiScale_16u8u_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, hint);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiScale_16u8u_C3R", status));
			NPPException.CheckNppStatus(status, this);
		}
开发者ID:lvaleriu,项目名称:managedCuda,代码行数:12,代码来源:NPPImage_16uC3.cs

示例4: Xor

 /// <summary>
 /// In place image logical Xor.
 /// </summary>
 /// <param name="src2">2nd source image</param>
 public void Xor(NPPImage_8uC3 src2)
 {
     status = NPPNativeMethods.NPPi.Xor.nppiXor_8u_C3IR(src2.DevicePointerRoi, src2.Pitch, _devPtrRoi, _pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiXor_8u_C3IR", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:10,代码来源:NPPImage_8uC3.cs

示例5: YUVToRGB

 /// <summary>
 /// 3 channel 8-bit unsigned packed YUV to 3 channel 8-bit unsigned packed RGB color conversion.
 /// </summary>
 /// <param name="dest">Destination image</param>  
 public void YUVToRGB(NPPImage_8uC3 dest)
 {
     NppStatus status = NPPNativeMethods.NPPi.YUVToRGB.nppiYUVToRGB_8u_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiYUVToRGB_8u_C3R", status));
     NPPException.CheckNppStatus(status, null);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:10,代码来源:NPPImage_8uC3.cs

示例6: Threshold

 /// <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_8uC3 dest, byte[] nThreshold, byte[] nValue, NppCmpOp eComparisonOperation)
 {
     status = NPPNativeMethods.NPPi.Threshold.nppiThreshold_Val_8u_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, nThreshold, nValue, eComparisonOperation);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiThreshold_Val_8u_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_8uC3.cs

示例7: Transpose

 /// <summary>
 /// image transpose
 /// </summary>
 /// <param name="dest">Destination image</param>
 public void Transpose(NPPImage_8uC3 dest)
 {
     status = NPPNativeMethods.NPPi.Transpose.nppiTranspose_8u_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiTranspose_8u_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:10,代码来源:NPPImage_8uC3.cs

示例8: NormDiff_Inf

        /// <summary>
        /// image NormDiff_Inf. Buffer is internally allocated and freed.
        /// </summary>
        /// <param name="tpl">template image.</param>
        /// <param name="pNormDiff">Pointer to the computed Inf-norm of differences. (3 * sizeof(double))</param>
        public void NormDiff_Inf(NPPImage_8uC3 tpl, CudaDeviceVariable<double> pNormDiff)
        {
            int bufferSize = NormDiffInfGetBufferHostSize();
            CudaDeviceVariable<byte> buffer = new CudaDeviceVariable<byte>(bufferSize);

            status = NPPNativeMethods.NPPi.NormDiff.nppiNormDiff_Inf_8u_C3R(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, _sizeRoi, pNormDiff.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormDiff_Inf_8u_C3R", status));
            buffer.Dispose();
            NPPException.CheckNppStatus(status, this);
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_8uC3.cs

示例9: NormRel_L2

        /// <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_8uC3 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_8u_C3R(_devPtrRoi, _pitch, tpl.DevicePointerRoi, tpl.Pitch, _sizeRoi, pNormRel.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiNormRel_L2_8u_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_8uC3.cs

示例10: MaximumRelativeError

        /// <summary>
        /// image maximum 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 MaximumRelativeError operation.</param>
        public void MaximumRelativeError(NPPImage_8uC3 src2, CudaDeviceVariable<double> pError, CudaDeviceVariable<byte> buffer)
        {
            int bufferSize = MaximumRelativeErrorGetBufferHostSize();
            if (bufferSize > buffer.Size) throw new NPPException("Provided buffer is too small.");

            status = NPPNativeMethods.NPPi.MaximumRelativeError.nppiMaximumRelativeError_8u_C3R(_devPtrRoi, _pitch, src2.DevicePointerRoi, src2.Pitch, _sizeRoi, pError.DevicePointer, buffer.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMaximumRelativeError_8u_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_8uC3.cs

示例11: Mirror

 /// <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_8uC3 dest, NppiAxis flip)
 {
     status = NPPNativeMethods.NPPi.GeometricTransforms.nppiMirror_8u_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, dest.SizeRoi, flip);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiMirror_8u_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:11,代码来源:NPPImage_8uC3.cs

示例12: LUTPalette

 /// <summary>
 /// range restricted palette look-up-table color conversion.
 /// The LUT is derived from a set of user defined mapping points in a palette and 
 /// source pixels are then processed using a restricted bit range when looking up palette values.
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="pTable">Host pointer to an array of 3 device memory pointers, one per color CHANNEL, pointing to user defined OUTPUT palette values.</param>
 /// <param name="nBitSize">Number of least significant bits (must be &gt; 0 and &lt;= 8) of each source pixel value to use as index into palette table during conversion.</param>
 public void LUTPalette(NPPImage_8uC3 dst, CudaDeviceVariable<byte>[] pTable, int nBitSize)
 {
     CUdeviceptr[] ptrsT = new CUdeviceptr[] { pTable[0].DevicePointer, pTable[1].DevicePointer, pTable[2].DevicePointer };
     status = NPPNativeMethods.NPPi.ColorLUTPalette.nppiLUTPalette_8u_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, ptrsT, nBitSize);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLUTPalette_8u_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:15,代码来源:NPPImage_8uC3.cs

示例13: LUTCubic

 /// <summary>
 /// cubic interpolated look-up-table color conversion.
 /// The LUT is derived from a set of user defined mapping points through cubic interpolation. 
 /// </summary>
 /// <param name="dst">Destination-Image</param>
 /// <param name="pValues">Host pointer to an array of 3 device memory pointers, one per color CHANNEL, pointing to user defined OUTPUT values.</param>
 /// <param name="pLevels">Host pointer to an array of 3 device memory pointers, one per color CHANNEL, pointing to user defined INPUT values. pLevels.Size gives nLevels.</param>
 public void LUTCubic(NPPImage_8uC3 dst, CudaDeviceVariable<int>[] pValues, CudaDeviceVariable<int>[] pLevels)
 {
     CUdeviceptr[] ptrsV = new CUdeviceptr[] { pValues[0].DevicePointer, pValues[1].DevicePointer, pValues[2].DevicePointer };
     CUdeviceptr[] ptrsL = new CUdeviceptr[] { pLevels[0].DevicePointer, pLevels[1].DevicePointer, pLevels[2].DevicePointer };
     int[] size = new int[] { (int)pLevels[0].Size, (int)pLevels[1].Size, (int)pLevels[2].Size };
     status = NPPNativeMethods.NPPi.ColorLUTCubic.nppiLUT_Cubic_8u_C3R(_devPtrRoi, _pitch, dst.DevicePointerRoi, dst.Pitch, _sizeRoi, ptrsV, ptrsL, size);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLUT_Cubic_8u_C3R", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:16,代码来源:NPPImage_8uC3.cs

示例14: Lut

        /// <summary>
        /// look-up-table color conversion.<para/>
        /// The LUT is derived from a set of user defined mapping points through linear interpolation.
        /// </summary>
        /// <param name="dest">Destination image</param>
        /// <param name="values0">array of user defined OUTPUT values, channel 0</param>
        /// <param name="levels0">array of user defined INPUT values, channel 0</param>
        /// <param name="values1">array of user defined OUTPUT values, channel 1</param>
        /// <param name="levels1">array of user defined INPUT values, channel 1</param>
        /// <param name="values2">array of user defined OUTPUT values, channel 2</param>
        /// <param name="levels2">array of user defined INPUT values, channel 2</param>
        public void Lut(NPPImage_8uC3 dest, CudaDeviceVariable<int> values0, CudaDeviceVariable<int> levels0, CudaDeviceVariable<int> values1, CudaDeviceVariable<int> levels1, CudaDeviceVariable<int> values2, CudaDeviceVariable<int> levels2)
        {
            if (values0.Size != levels0.Size) throw new ArgumentException("values0 and levels0 must have same size.");
            if (values1.Size != levels1.Size) throw new ArgumentException("values1 and levels1 must have same size.");
            if (values2.Size != levels2.Size) throw new ArgumentException("values2 and levels2 must have same size.");

            CUdeviceptr[] values = new CUdeviceptr[3];
            CUdeviceptr[] levels = new CUdeviceptr[3];
            int[] levelLengths = new int[3];

            values[0] = values0.DevicePointer;
            values[1] = values1.DevicePointer;
            values[2] = values2.DevicePointer;
            levels[0] = levels0.DevicePointer;
            levels[1] = levels1.DevicePointer;
            levels[2] = levels2.DevicePointer;

            levelLengths[0] = (int)levels0.Size;
            levelLengths[1] = (int)levels1.Size;
            levelLengths[2] = (int)levels2.Size;

            status = NPPNativeMethods.NPPi.ColorProcessing.nppiLUT_Linear_8u_C3R(_devPtrRoi, _pitch, dest.DevicePointerRoi, dest.Pitch, _sizeRoi, values, levels, levelLengths);

            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiLUT_Linear_8u_C3R", status));
            NPPException.CheckNppStatus(status, this);
        }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:37,代码来源:NPPImage_8uC3.cs

示例15: SqrDistanceValid_Norm

 /// <summary>
 /// image SqrDistanceValid_Norm.
 /// </summary>
 /// <param name="tpl">template image.</param>
 /// <param name="dst">Destination-Image</param>
 /// <param name="nScaleFactor">Integer Result Scaling.</param>
 public void SqrDistanceValid_Norm(NPPImage_8uC3 tpl, NPPImage_8uC3 dst, int nScaleFactor)
 {
     status = NPPNativeMethods.NPPi.ImageProximity.nppiSqrDistanceValid_Norm_8u_C3RSfs(_devPtrRoi, _pitch, _sizeRoi, tpl.DevicePointerRoi, tpl.Pitch, tpl.SizeRoi, dst.DevicePointerRoi, dst.Pitch, nScaleFactor);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nppiSqrDistanceValid_Norm_8u_C3RSfs", status));
     NPPException.CheckNppStatus(status, this);
 }
开发者ID:kunzmi,项目名称:managedCuda,代码行数:12,代码来源:NPPImage_8uC3.cs


注:本文中的ManagedCuda.NPP.NPPImage_8uC3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。