本文整理汇总了C++中Mat_d::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat_d::clear方法的具体用法?C++ Mat_d::clear怎么用?C++ Mat_d::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat_d
的用法示例。
在下文中一共展示了Mat_d::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMatchingFromTracks
int getMatchingFromTracks(std::vector<const Track2D*>& vecPTracks, int f1, int f2, Mat_d& pts1, Mat_d& pts2) {
if (f1 >= f2)
repErr("getMatchingFrameTracks - f1 >= f2\n");
pts1.clear();
pts2.clear();
size_t nTracks = vecPTracks.size();
pts1.resize(nTracks, 2);
pts2.resize(nTracks, 2);
int k = 0;
for (size_t i = 0; i < nTracks; i++) {
Track2DNode* p = vecPTracks[i]->head.next;
Track2DNode* tail = vecPTracks[i]->tail->next;
bool bFoundPts1 = false;
while (p != tail) {
if (p->f == f1) {
pts1.data[2 * k] = p->x;
pts1.data[2 * k + 1] = p->y;
bFoundPts1 = true;
}
if (bFoundPts1 && p->f == f2) {
pts2.data[2 * k] = p->x;
pts2.data[2 * k + 1] = p->y;
k++;
break; //found a matching in the track, jump to the next track
}
p = p->next;
}
}
pts1.rows = k;
pts2.rows = k;
return k;
}
示例2: getPointsFromTracks
/* get points at frame f*/
void getPointsFromTracks(std::vector<const Track2D*>& vecPTracks, int f, Mat_d& pts) {
pts.clear();
size_t nTracks = vecPTracks.size();
pts.resize(nTracks, 2);
int k = 0;
for (size_t i = 0; i < nTracks; i++) {
Track2DNode* p = vecPTracks[i]->head.next;
Track2DNode* tail = vecPTracks[i]->tail->next;
while (p != tail) {
if (p->f == f) {
pts.data[2 * k] = p->x;
pts.data[2 * k + 1] = p->y;
k++;
break;
}
p = p->next;
}
}
pts.rows = k;
}