我最近在 OpenCV 中从使用 C 接口更改为 C++ 接口。在C 接口中,有很多C++ 接口中似乎不存在的东西。有谁知道这些问题的解决方案:
1)在C接口中有一个称为轮廓扫描仪的对象。它用于一张一张地查找图像中的轮廓。我将如何在 C++ 中做到这一点?我不想一次找到所有轮廓,而是一次找到一个。
2) 在 C 中,CvSeq
用于表示轮廓,但在 C++ 中,vector 表示轮廓。使用 >
。在 CI 中,可以使用 h_next
访问下一个轮廓。 h_next
在 C++ 中的等价物是什么?
I recently changed from using the C interface to the C++ interface in OpenCV. In the C interface, there were a variety of things that don't seem to exist in the C++ one. Does anyone know the solution to these problems:
1) In the C interface there was an object called a Contour Scanner. It was used to find contours in an image one by one. How would I do this in C++? Instead of finding all the contours at once, I want to find them one at a time.
2) In C CvSeq
was used to represent contours, however in C++ vector <vector<Point> >
is used. In C I was able to access the next contour by using h_next
. Whats the C++ equivalent of h_next
?
发布评论
评论(1)
我不确定你是否可以一次获取一个轮廓。但是如果你有一个向量<向量<点> > 您可以按如下方式迭代每个轮廓:
因此,为了更好地回答有关
h_next
的问题。给定向量it
中的迭代器it
,下一个元素将是it+1
。用法示例:I'm not sure if you can get the contours one at a time. But if you have a
vector<vector<Point> >
you can iterate over each contour as follows:Therefore to better answer your question about
h_next
. Given the iterator,it
, in thevector
, the next element would beit+1
. Example Usage: