本文整理汇总了C#中GpuMat.ConvertTo方法的典型用法代码示例。如果您正苦于以下问题:C# GpuMat.ConvertTo方法的具体用法?C# GpuMat.ConvertTo怎么用?C# GpuMat.ConvertTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuMat
的用法示例。
在下文中一共展示了GpuMat.ConvertTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCudaImageAsyncOps
public void TestCudaImageAsyncOps()
{
if (CudaInvoke.HasCuda)
{
int counter = 0;
Stopwatch watch = Stopwatch.StartNew();
using (GpuMat img1 = new GpuMat(3000, 2000, DepthType.Cv8U, 3))
using (GpuMat img2 = new GpuMat(3000, 2000, DepthType.Cv8U, 3))
using (GpuMat img3 = new GpuMat())
using (Stream stream = new Stream())
using (GpuMat mat1 = new GpuMat())
{
img1.ConvertTo(mat1, DepthType.Cv8U, 1, 0, stream);
while (!stream.Completed)
{
if (counter <= int.MaxValue) counter++;
}
Trace.WriteLine(String.Format("Counter has been incremented {0} times", counter));
counter = 0;
CudaInvoke.CvtColor(img2, img3, CvToolbox.GetColorCvtCode(typeof(Bgr), typeof(Gray)), 1, stream);
while (!stream.Completed)
{
if (counter <= int.MaxValue) counter++;
}
Trace.WriteLine(String.Format("Counter has been incremented {0} times", counter));
}
watch.Stop();
Trace.WriteLine(String.Format("Total time: {0} milliseconds", watch.ElapsedMilliseconds));
}
}