本文整理汇总了C#中GpuMat.Upload方法的典型用法代码示例。如果您正苦于以下问题:C# GpuMat.Upload方法的具体用法?C# GpuMat.Upload怎么用?C# GpuMat.Upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuMat
的用法示例。
在下文中一共展示了GpuMat.Upload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Solve
public Image<Gray, byte> Solve(Image<Gray, byte> left, Image<Gray, byte> right)
{
var size = left.Size;
using (var leftGpu = new GpuMat(left.Rows, left.Cols, DepthType.Cv16S, 1))
using (var rightGpu = new GpuMat(left.Rows, left.Cols, DepthType.Cv16S, 1))
using (var disparityGpu = new GpuMat(left.Rows, left.Cols, DepthType.Cv16S, 1))
using (var filteredDisparityGpu = new GpuMat(left.Rows, left.Cols, DepthType.Cv16S, 1))
using (var filteredDisparity16S = new Mat(size, DepthType.Cv16S, 1))
using (var filteredDisparity8U = new Mat(size, DepthType.Cv8U, 1))
{
leftGpu.Upload(left.Mat);
rightGpu.Upload(right.Mat);
algorithm.FindStereoCorrespondence(leftGpu, rightGpu, disparityGpu);
filter.Apply(disparityGpu, leftGpu, filteredDisparityGpu);
filteredDisparityGpu.Download(filteredDisparity16S);
CvInvoke.MinMaxLoc(filteredDisparity16S, ref min, ref max, ref minPosition, ref maxPosition);
filteredDisparity16S.ConvertTo(filteredDisparity8U, DepthType.Cv8U, 255.0/(Max - Min));
return new Image<Gray, byte>(filteredDisparity8U.Bitmap);
}
}
示例2: TestCudaUploadDownload
public void TestCudaUploadDownload()
{
if (!CudaInvoke.HasCuda)
return;
Mat m = new Mat(new Size(480, 320), DepthType.Cv8U, 3);
CvInvoke.Randu(m, new MCvScalar(), new MCvScalar(255, 255, 255) );
#region test for async download & upload
Stream stream = new Stream();
GpuMat gm1 = new GpuMat();
gm1.Upload(m, stream);
Mat m2 = new Mat();
gm1.Download(m2, stream);
stream.WaitForCompletion();
EmguAssert.IsTrue(m.Equals(m2));
#endregion
#region test for blocking download & upload
GpuMat gm2 = new GpuMat();
gm2.Upload(m);
Mat m3 = new Mat();
gm2.Download(m3);
EmguAssert.IsTrue(m.Equals(m3));
#endregion
}