本文整理匯總了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();
}