Emguc中如何把VectorOfVectorOfPoint转换成点集
时间: 2024-02-21 08:59:38 浏览: 46
要将`VectorOfVectorOfPoint`转换为点集,请遍历`VectorOfVectorOfPoint`中的每个`VectorOfPoint`,然后将其转换为一个列表,这个列表包含了该`VectorOfPoint`中的所有点。以下是示例代码:
```csharp
using Emgu.CV;
using Emgu.CV.Structure;
using System.Collections.Generic;
// 假设您已经定义了一个名为"contours"的VectorOfVectorOfPoint对象
// 定义一个存储点集的变量
List<List<Point>> pointSets = new List<List<Point>>();
for (int i = 0; i < contours.Size; i++)
{
VectorOfPoint contour = contours[i];
List<Point> pointSet = new List<Point>(contour.ToArray());
pointSets.Add(pointSet);
}
```
在这段代码中,我们首先定义了一个`List<List<Point>>`类型的变量,用于存储点集。然后,我们遍历`VectorOfVectorOfPoint`中的每个`VectorOfPoint`,将其转换为一个点列表,并将其添加到`pointSets`变量中。请注意,我们使用了`ToArray`函数将`VectorOfPoint`转换为一个数组,以便我们可以将其转换为一个点列表。
希望这可以帮助您将`VectorOfVectorOfPoint`转换为点集。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)