本文整理汇总了C#中OpenCvSharp.CPlusPlus.Mat.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Mat.Clone方法的具体用法?C# Mat.Clone怎么用?C# Mat.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCvSharp.CPlusPlus.Mat
的用法示例。
在下文中一共展示了Mat.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StitchingPreprocess
private static Mat[] StitchingPreprocess(int width, int height, int count)
{
Mat source = new Mat(@"C:\Penguins.jpg", LoadMode.Color);
Mat result = source.Clone();
var rand = new Random();
var mats = new List<Mat>();
for (int i = 0; i < count; i++)
{
int x1 = rand.Next(source.Cols - width);
int y1 = rand.Next(source.Rows - height);
int x2 = x1 + width;
int y2 = y1 + height;
result.Line(new Point(x1, y1), new Point(x1, y2), new Scalar(0, 0, 255));
result.Line(new Point(x1, y2), new Point(x2, y2), new Scalar(0, 0, 255));
result.Line(new Point(x2, y2), new Point(x2, y1), new Scalar(0, 0, 255));
result.Line(new Point(x2, y1), new Point(x1, y1), new Scalar(0, 0, 255));
Mat m = source[new Rect(x1, y1, width, height)];
mats.Add(m.Clone());
//string outFile = String.Format(@"C:\temp\stitching\{0:D3}.png", i);
//m.SaveImage(outFile);
}
result.SaveImage(@"C:\temp\parts.png");
using (new Window(result))
{
Cv.WaitKey();
}
return mats.ToArray();
}